From 509c351f85fa09a425b0ad8bf0c956a64f1884de Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 24 Jul 2026 15:34:11 +0100 Subject: [PATCH 1/7] CP-2453 Add core test mock server and exception status mapping Move the integration mock server into test-only sdk_test_support helpers and expose ApiException.exception_class_for_http_status for generated integration error assertions. Co-authored-by: Cursor --- .../src/thousandeyes_sdk/core/exceptions.py | 38 ++-- thousandeyes-sdk-core/test/conftest.py | 6 + .../test/sdk_test_support/__init__.py | 1 + .../test/sdk_test_support/mock_server.py | 209 ++++++++++++++++++ .../sdk_test_support/mock_server_types.py | 41 ++++ thousandeyes-sdk-core/test/test_exceptions.py | 28 +++ .../test/test_mock_server.py | 187 ++++++++++++++++ 7 files changed, 491 insertions(+), 19 deletions(-) create mode 100644 thousandeyes-sdk-core/test/conftest.py create mode 100644 thousandeyes-sdk-core/test/sdk_test_support/__init__.py create mode 100644 thousandeyes-sdk-core/test/sdk_test_support/mock_server.py create mode 100644 thousandeyes-sdk-core/test/sdk_test_support/mock_server_types.py create mode 100644 thousandeyes-sdk-core/test/test_exceptions.py create mode 100644 thousandeyes-sdk-core/test/test_mock_server.py diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py index 4a88a6e1..35ceb2e0 100644 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py @@ -14,7 +14,7 @@ # # SPDX-License-Identifier: Apache-2.0 -from typing import Any, Optional +from typing import Any, Optional, Type from typing_extensions import Self @@ -135,6 +135,22 @@ class ApiException(OpenApiException): pass self.headers = http_resp.getheaders() + @classmethod + def exception_class_for_http_status(cls, status: int) -> Type["ApiException"]: + if status == 400: + return BadRequestException + if status == 401: + return UnauthorizedException + if status == 403: + return ForbiddenException + if status == 404: + return NotFoundException + if status == 429: + return TooManyRequestsException + if 500 <= status <= 599: + return ServiceException + return ApiException + @classmethod def from_response( cls, @@ -143,24 +159,8 @@ class ApiException(OpenApiException): body: Optional[str], data: Optional[Any], ) -> Self: - if http_resp.status == 400: - raise BadRequestException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 401: - raise UnauthorizedException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 403: - raise ForbiddenException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 404: - raise NotFoundException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 429: - raise TooManyRequestsException(http_resp=http_resp, body=body, data=data) - - if 500 <= http_resp.status <= 599: - raise ServiceException(http_resp=http_resp, body=body, data=data) - raise ApiException(http_resp=http_resp, body=body, data=data) + exc_class = cls.exception_class_for_http_status(http_resp.status) + raise exc_class(http_resp=http_resp, body=body, data=data) def __str__(self): """Custom error messages for exception""" diff --git a/thousandeyes-sdk-core/test/conftest.py b/thousandeyes-sdk-core/test/conftest.py new file mode 100644 index 00000000..593b2f00 --- /dev/null +++ b/thousandeyes-sdk-core/test/conftest.py @@ -0,0 +1,6 @@ +import sys +from pathlib import Path + +_core_test_support = Path(__file__).resolve().parent +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-core/test/sdk_test_support/__init__.py b/thousandeyes-sdk-core/test/sdk_test_support/__init__.py new file mode 100644 index 00000000..468d5bfc --- /dev/null +++ b/thousandeyes-sdk-core/test/sdk_test_support/__init__.py @@ -0,0 +1 @@ +# Test-only helpers for SDK integration tests. Not shipped in the published package. diff --git a/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py b/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py new file mode 100644 index 00000000..37354bca --- /dev/null +++ b/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py @@ -0,0 +1,209 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +import json +import re +import threading +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer +from typing import Any, Dict, Mapping, Optional +from urllib.parse import urlparse + +from sdk_test_support.mock_server_types import OperationExpectation + +OPERATION_ID_HEADER = "X-TE-Operation-Id" +ERROR_STATUS_HEADER = "X-TE-Error-Status" +AUTHORIZATION_HEADER = "Authorization" + + +def _normalize_json(value: Any) -> Any: + if isinstance(value, dict): + return {key: _normalize_json(value[key]) for key in sorted(value.keys())} + if isinstance(value, list): + return [_normalize_json(item) for item in value] + return value + + +def _json_body_matches(expected: Any, actual: Any) -> bool: + if isinstance(expected, dict) and isinstance(actual, dict): + filtered_expected = {key: expected[key] for key in actual if key in expected} + return _normalize_json(filtered_expected) == _normalize_json(actual) + return _normalize_json(expected) == _normalize_json(actual) + + +class MockApiServer: + def __init__(self, manifest: Mapping[str, OperationExpectation], host: str = "127.0.0.1", port: int = 0): + self._manifest = dict(manifest) + self._host = host + self._port = port + self._server: Optional[ThreadingHTTPServer] = None + self._thread: Optional[threading.Thread] = None + + @property + def base_url(self) -> str: + if self._server is None: + raise RuntimeError("MockApiServer has not been started") + return f"http://{self._host}:{self._server.server_port}" + + def start(self) -> None: + if self._server is not None: + return + + manifest = self._manifest + handler = _build_handler(manifest) + self._server = ThreadingHTTPServer((self._host, self._port), handler) + self._thread = threading.Thread(target=self._server.serve_forever, daemon=True) + self._thread.start() + + def stop(self) -> None: + if self._server is None: + return + self._server.shutdown() + self._server.server_close() + if self._thread is not None: + self._thread.join(timeout=5) + self._server = None + self._thread = None + + def __enter__(self) -> "MockApiServer": + self.start() + return self + + def __exit__(self, exc_type, exc, tb) -> None: + self.stop() + + +def _build_handler(manifest: Mapping[str, OperationExpectation]): + class MockApiRequestHandler(BaseHTTPRequestHandler): + def log_message(self, format: str, *args) -> None: + return + + def do_GET(self) -> None: + self._handle_request("GET") + + def do_POST(self) -> None: + self._handle_request("POST") + + def do_PUT(self) -> None: + self._handle_request("PUT") + + def do_PATCH(self) -> None: + self._handle_request("PATCH") + + def do_DELETE(self) -> None: + self._handle_request("DELETE") + + def _handle_request(self, method: str) -> None: + auth_error = _validate_authorization(self.headers.get(AUTHORIZATION_HEADER)) + if auth_error is not None: + self._write_json(auth_error, 401) + return + + operation_id = self.headers.get(OPERATION_ID_HEADER) + if not operation_id: + self._write_json({"detail": f"Missing required header {OPERATION_ID_HEADER}"}, 400) + return + + expectation = manifest.get(operation_id) + if expectation is None: + self._write_json({"detail": f"Unknown operation id {operation_id}"}, 400) + return + + if expectation.method.upper() != method.upper(): + self._write_json( + {"detail": f"Unexpected HTTP method {method} for operation {operation_id}"}, + 400, + ) + return + + parsed = urlparse(self.path) + if not _path_matches(expectation.path, parsed.path): + self._write_json({"detail": "Path does not match operation expectation"}, 400) + return + + error_status_header = self.headers.get(ERROR_STATUS_HEADER) + if error_status_header: + self._handle_error_response(expectation, error_status_header) + return + + body_bytes = _read_body(self) + if expectation.request_body_example is not None: + if not body_bytes: + self._write_json({"detail": "Expected request body"}, 400) + return + try: + request_json = json.loads(body_bytes.decode("utf-8")) + except json.JSONDecodeError: + self._write_json({"detail": "Invalid JSON request body"}, 400) + return + if not _json_body_matches(expectation.request_body_example, request_json): + self._write_json({"detail": "Request body does not match OAS example"}, 400) + return + + if expectation.success_body is None: + self.send_response(expectation.success_status) + self.end_headers() + return + + self._write_json( + expectation.success_body, + expectation.success_status, + expectation.success_content_type, + ) + + def _handle_error_response(self, expectation: OperationExpectation, error_status_header: str) -> None: + error_response = expectation.error_responses.get(error_status_header) + if error_response is None: + self._write_json( + {"detail": f"No configured error response for status {error_status_header}"}, + 400, + ) + return + if error_response.body is None: + self.send_response(error_response.status) + self.end_headers() + return + self._write_json(error_response.body, error_response.status, error_response.content_type) + + def _write_json(self, body: Any, status: int, content_type: str = "application/json") -> None: + payload = json.dumps(body).encode("utf-8") + self.send_response(status) + self.send_header("Content-Type", content_type) + self.send_header("Content-Length", str(len(payload))) + self.end_headers() + self.wfile.write(payload) + + return MockApiRequestHandler + + +def _validate_authorization(value: Optional[str]) -> Optional[Dict[str, str]]: + if value is None or not value.strip(): + return {"detail": f"Missing or empty required header {AUTHORIZATION_HEADER}"} + return None + + +def _read_body(handler: BaseHTTPRequestHandler) -> bytes: + length = handler.headers.get("Content-Length") + if not length: + return b"" + return handler.rfile.read(int(length)) + + +def _path_matches(template: str, actual_path: str) -> bool: + pattern = re.sub(r"\{[^/]+\}", r"[^/]+", template) + pattern = f"^{pattern}$" + return re.match(pattern, actual_path) is not None diff --git a/thousandeyes-sdk-core/test/sdk_test_support/mock_server_types.py b/thousandeyes-sdk-core/test/sdk_test_support/mock_server_types.py new file mode 100644 index 00000000..281dcfd3 --- /dev/null +++ b/thousandeyes-sdk-core/test/sdk_test_support/mock_server_types.py @@ -0,0 +1,41 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Any, Dict + + +@dataclass(frozen=True) +class ErrorResponseExpectation: + status: int + body: Any + content_type: str = "application/problem+json" + + +@dataclass(frozen=True) +class OperationExpectation: + operation_id: str + method: str + path: str + success_status: int + success_body: Any = None + success_content_type: str = "application/json" + request_body_example: Any = None + path_param_examples: Dict[str, str] = field(default_factory=dict) + query_param_examples: Dict[str, str] = field(default_factory=dict) + error_responses: Dict[str, ErrorResponseExpectation] = field(default_factory=dict) diff --git a/thousandeyes-sdk-core/test/test_exceptions.py b/thousandeyes-sdk-core/test/test_exceptions.py new file mode 100644 index 00000000..9c4be033 --- /dev/null +++ b/thousandeyes-sdk-core/test/test_exceptions.py @@ -0,0 +1,28 @@ +import pytest + +from thousandeyes_sdk.core.exceptions import ( + ApiException, + BadRequestException, + ForbiddenException, + NotFoundException, + ServiceException, + TooManyRequestsException, + UnauthorizedException, +) + + +@pytest.mark.parametrize( + ("status", "expected"), + [ + (400, BadRequestException), + (401, UnauthorizedException), + (403, ForbiddenException), + (404, NotFoundException), + (429, TooManyRequestsException), + (500, ServiceException), + (503, ServiceException), + (418, ApiException), + ], +) +def test_exception_class_for_http_status(status, expected): + assert ApiException.exception_class_for_http_status(status) is expected diff --git a/thousandeyes-sdk-core/test/test_mock_server.py b/thousandeyes-sdk-core/test/test_mock_server.py new file mode 100644 index 00000000..d847a309 --- /dev/null +++ b/thousandeyes-sdk-core/test/test_mock_server.py @@ -0,0 +1,187 @@ +import json + +import pytest + +from sdk_test_support.mock_server import ( + AUTHORIZATION_HEADER, + ERROR_STATUS_HEADER, + OPERATION_ID_HEADER, + MockApiServer, +) +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + + +@pytest.fixture +def manifest(): + return { + "createAlertRule": OperationExpectation( + operation_id="createAlertRule", + method="POST", + path="/alerts/rules", + request_body_example={"ruleName": "Example"}, + success_status=201, + success_body={"ruleId": "1"}, + error_responses={ + "400": ErrorResponseExpectation( + status=400, + body={"title": "Bad Request", "status": 400}, + ) + }, + ), + "deleteAlertRule": OperationExpectation( + operation_id="deleteAlertRule", + method="DELETE", + path="/alerts/rules/{ruleId}", + path_param_examples={"ruleId": "127094"}, + success_status=204, + success_body=None, + ), + "getAlertRule": OperationExpectation( + operation_id="getAlertRule", + method="GET", + path="/alerts/rules/{ruleId}", + path_param_examples={"ruleId": "127094"}, + success_status=200, + success_body={"ruleId": "127094", "ruleName": "Example"}, + ), + } + + +def _request(server: MockApiServer, *, method: str, path: str, headers=None, body=None): + import urllib.request + + request_headers = { + AUTHORIZATION_HEADER: "Bearer test-token", + OPERATION_ID_HEADER: "createAlertRule", + } + if headers: + request_headers.update(headers) + + data = None + if body is not None: + data = json.dumps(body).encode("utf-8") + request_headers["Content-Type"] = "application/json" + + request = urllib.request.Request( + server.base_url + path, + data=data, + headers=request_headers, + method=method, + ) + try: + with urllib.request.urlopen(request) as response: + return response.status, response.read() + except urllib.error.HTTPError as exc: + return exc.code, exc.read() + + +def test_mock_server_happy_path(manifest): + with MockApiServer(manifest) as server: + status, body = _request( + server, + method="POST", + path="/alerts/rules", + body={"ruleName": "Example"}, + ) + assert status == 201 + assert json.loads(body.decode("utf-8")) == {"ruleId": "1"} + + +def test_mock_server_rejects_missing_authorization(manifest): + with MockApiServer(manifest) as server: + status, _ = _request( + server, + method="POST", + path="/alerts/rules", + headers={AUTHORIZATION_HEADER: ""}, + body={"ruleName": "Example"}, + ) + assert status == 401 + + +def test_mock_server_rejects_invalid_request_body(manifest): + with MockApiServer(manifest) as server: + status, _ = _request( + server, + method="POST", + path="/alerts/rules", + body={"ruleName": "Wrong"}, + ) + assert status == 400 + + +def test_mock_server_error_path(manifest): + with MockApiServer(manifest) as server: + status, body = _request( + server, + method="POST", + path="/alerts/rules", + headers={ERROR_STATUS_HEADER: "400"}, + body={"unexpected": True}, + ) + assert status == 400 + assert json.loads(body.decode("utf-8"))["title"] == "Bad Request" + + +def test_mock_server_ignores_readonly_fields_in_expected_body(manifest): + readonly_manifest = { + **manifest, + "createAlertRule": OperationExpectation( + operation_id="createAlertRule", + method="POST", + path="/alerts/rules", + request_body_example={"ruleName": "Example", "ruleId": "read-only"}, + success_status=201, + success_body={"ruleId": "1"}, + ), + } + with MockApiServer(readonly_manifest) as server: + status, body = _request( + server, + method="POST", + path="/alerts/rules", + body={"ruleName": "Example"}, + ) + assert status == 201 + assert json.loads(body.decode("utf-8")) == {"ruleId": "1"} + + +def test_mock_server_no_content_response(manifest): + with MockApiServer(manifest) as server: + import urllib.request + + request = urllib.request.Request( + server.base_url + "/alerts/rules/127094", + headers={ + AUTHORIZATION_HEADER: "Bearer test-token", + OPERATION_ID_HEADER: "deleteAlertRule", + }, + method="DELETE", + ) + with urllib.request.urlopen(request) as response: + assert response.status == 204 + assert response.read() == b"" + + +def test_mock_server_matches_path_variable(manifest): + with MockApiServer(manifest) as server: + status, body = _request( + server, + method="GET", + path="/alerts/rules/127094", + headers={OPERATION_ID_HEADER: "getAlertRule"}, + ) + assert status == 200 + assert json.loads(body.decode("utf-8")) == {"ruleId": "127094", "ruleName": "Example"} + + +def test_mock_server_rejects_path_missing_path_variable(manifest): + with MockApiServer(manifest) as server: + status, body = _request( + server, + method="GET", + path="/alerts/rules", + headers={OPERATION_ID_HEADER: "getAlertRule"}, + ) + assert status == 400 + assert json.loads(body.decode("utf-8"))["detail"] == "Path does not match operation expectation" From 5441f44f1ff132954ef7c84509ad32d366258c0d Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 28 Jul 2026 12:07:00 +0100 Subject: [PATCH 2/7] 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 --- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3252 +++ .../test_account_groups_api_integration.py | 1792 ++ .../test/test_permissions_api_integration.py | 219 + .../test/test_roles_api_integration.py | 1119 + .../test/test_user_events_api_integration.py | 324 + .../test/test_users_api_integration.py | 1583 ++ thousandeyes-sdk-agents/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-agents/test/mock_manifest.py | 2459 +++ .../test_agent_proxies_api_integration.py | 224 + ...gent_notification_rules_api_integration.py | 482 + ...d_and_enterprise_agents_api_integration.py | 1206 + ...nterprise_agent_cluster_api_integration.py | 777 + .../test_local_problems_api_integration.py | 304 + ...ts_assignment_on_agents_api_integration.py | 1184 + thousandeyes-sdk-alerts/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-alerts/test/mock_manifest.py | 2247 ++ .../test/test_alert_rules_api_integration.py | 2030 ++ ...ert_suppression_windows_api_integration.py | 1565 ++ .../test/test_alerts_api_integration.py | 632 + thousandeyes-sdk-connectors/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3021 +++ ...ential_vault_operations_api_integration.py | 1305 ++ ...r_ark_conjur_connectors_api_integration.py | 1434 ++ ...test_generic_connectors_api_integration.py | 1524 ++ ...st_operation_connectors_api_integration.py | 210 + ...test_webhook_operations_api_integration.py | 1344 ++ thousandeyes-sdk-credentials/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 604 + .../test/test_credentials_api_integration.py | 1040 + thousandeyes-sdk-dashboards/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 5061 +++++ ...est_dashboard_snapshots_api_integration.py | 2466 +++ .../test/test_dashboards_api_integration.py | 4825 ++++ ...test_dashboards_filters_api_integration.py | 1602 ++ thousandeyes-sdk-emulation/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 340 + .../test/test_emulation_api_integration.py | 548 + .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 2514 +++ ...ndpoint_agent_log_items_api_integration.py | 365 + .../test_endpoint_agents_api_integration.py | 2767 +++ ...ndpoint_agents_transfer_api_integration.py | 300 + .../test_endpoint_proxies_api_integration.py | 166 + .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 499 + ...instant_scheduled_tests_api_integration.py | 369 + ...instant_scheduled_tests_api_integration.py | 457 + ...instant_scheduled_tests_api_integration.py | 236 + .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 575 + ...t_endpoint_agent_labels_api_integration.py | 1026 + .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 7512 +++++++ ..._scheduled_test_results_api_integration.py | 2255 ++ ...k_endpoint_test_results_api_integration.py | 1842 ++ ...c_endpoint_test_results_api_integration.py | 2162 ++ ..._scheduled_test_results_api_integration.py | 2784 +++ ...r_endpoint_test_results_api_integration.py | 2554 +++ .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 2809 +++ ..._endpoint_dynamic_tests_api_integration.py | 1435 ++ ...ndpoint_scheduled_tests_api_integration.py | 1448 ++ ...ndpoint_real_user_tests_api_integration.py | 166 + ...ndpoint_scheduled_tests_api_integration.py | 273 + ...ndpoint_scheduled_tests_api_integration.py | 1575 ++ .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 460 + .../test/test_events_api_integration.py | 704 + .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3980 ++++ ..._to_agent_instant_tests_api_integration.py | 816 + ...to_server_instant_tests_api_integration.py | 825 + .../test_api_instant_tests_api_integration.py | 1716 ++ ...ns_server_instant_tests_api_integration.py | 831 + ...dns_trace_instant_tests_api_integration.py | 726 + ...st_dnssec_instant_tests_api_integration.py | 717 + ...tp_server_instant_tests_api_integration.py | 861 + ...page_load_instant_tests_api_integration.py | 1392 ++ ...tp_server_instant_tests_api_integration.py | 1320 ++ .../test_instant_tests_api_integration.py | 35 + ...ip_server_instant_tests_api_integration.py | 868 + ...est_voice_instant_tests_api_integration.py | 780 + ...ansaction_instant_tests_api_integration.py | 1410 ++ .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 899 + ...ights_catalog_providers_api_integration.py | 621 + ...ternet_insights_outages_api_integration.py | 900 + thousandeyes-sdk-snapshots/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 213 + .../test_test_snapshots_api_integration.py | 395 + thousandeyes-sdk-streaming/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 759 + .../test/test_streaming_api_integration.py | 1358 ++ thousandeyes-sdk-tags/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-tags/test/mock_manifest.py | 1774 ++ .../test_tag_assignment_api_integration.py | 1633 ++ .../test/test_tags_api_integration.py | 2397 ++ .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 6272 ++++++ .../test_api_test_results_api_integration.py | 869 + ...dns_server_test_results_api_integration.py | 825 + ..._dns_trace_test_results_api_integration.py | 426 + ...est_dnssec_test_results_api_integration.py | 416 + ...etwork_bgp_test_results_api_integration.py | 757 + ...st_network_test_results_api_integration.py | 1336 ++ ...rtp_server_test_results_api_integration.py | 434 + ...sip_server_test_results_api_integration.py | 444 + ...ftp_server_test_results_api_integration.py | 438 + ...ttp_server_test_results_api_integration.py | 636 + ..._page_load_test_results_api_integration.py | 1211 + ...ansactions_test_results_api_integration.py | 1650 ++ thousandeyes-sdk-tests/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-tests/test/mock_manifest.py | 18313 ++++++++++++++++ ...st_agent_to_agent_tests_api_integration.py | 2596 +++ ...t_agent_to_server_tests_api_integration.py | 2433 ++ .../test/test_api_tests_api_integration.py | 4680 ++++ .../test/test_bgp_tests_api_integration.py | 2039 ++ .../test_dns_server_tests_api_integration.py | 2647 +++ .../test_dns_trace_tests_api_integration.py | 2283 ++ .../test/test_dnssec_tests_api_integration.py | 2262 ++ .../test_ftp_server_tests_api_integration.py | 2676 +++ .../test_http_server_tests_api_integration.py | 3772 ++++ .../test_page_load_tests_api_integration.py | 3982 ++++ ...zation_interface_groups_api_integration.py | 976 + .../test_sip_server_tests_api_integration.py | 2687 +++ .../test/test_tests_api_integration.py | 411 + .../test/test_voice_tests_api_integration.py | 2512 +++ ...t_web_transaction_tests_api_integration.py | 4001 ++++ thousandeyes-sdk-usage/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-usage/test/mock_manifest.py | 1183 + .../test/test_quotas_api_integration.py | 1280 ++ .../test/test_usage_api_integration.py | 815 + 154 files changed, 189388 insertions(+) create mode 100644 thousandeyes-sdk-administrative/test/conftest.py create mode 100644 thousandeyes-sdk-administrative/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-administrative/test/mock_manifest.py create mode 100644 thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py create mode 100644 thousandeyes-sdk-administrative/test/test_permissions_api_integration.py create mode 100644 thousandeyes-sdk-administrative/test/test_roles_api_integration.py create mode 100644 thousandeyes-sdk-administrative/test/test_user_events_api_integration.py create mode 100644 thousandeyes-sdk-administrative/test/test_users_api_integration.py create mode 100644 thousandeyes-sdk-agents/test/conftest.py create mode 100644 thousandeyes-sdk-agents/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-agents/test/mock_manifest.py create mode 100644 thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py create mode 100644 thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py create mode 100644 thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py create mode 100644 thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py create mode 100644 thousandeyes-sdk-agents/test/test_local_problems_api_integration.py create mode 100644 thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py create mode 100644 thousandeyes-sdk-alerts/test/conftest.py create mode 100644 thousandeyes-sdk-alerts/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-alerts/test/mock_manifest.py create mode 100644 thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py create mode 100644 thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py create mode 100644 thousandeyes-sdk-alerts/test/test_alerts_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/conftest.py create mode 100644 thousandeyes-sdk-connectors/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-connectors/test/mock_manifest.py create mode 100644 thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py create mode 100644 thousandeyes-sdk-credentials/test/conftest.py create mode 100644 thousandeyes-sdk-credentials/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-credentials/test/mock_manifest.py create mode 100644 thousandeyes-sdk-credentials/test/test_credentials_api_integration.py create mode 100644 thousandeyes-sdk-dashboards/test/conftest.py create mode 100644 thousandeyes-sdk-dashboards/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-dashboards/test/mock_manifest.py create mode 100644 thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py create mode 100644 thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py create mode 100644 thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py create mode 100644 thousandeyes-sdk-emulation/test/conftest.py create mode 100644 thousandeyes-sdk-emulation/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-emulation/test/mock_manifest.py create mode 100644 thousandeyes-sdk-emulation/test/test_emulation_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-event-detection/test/conftest.py create mode 100644 thousandeyes-sdk-event-detection/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-event-detection/test/mock_manifest.py create mode 100644 thousandeyes-sdk-event-detection/test/test_events_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/conftest.py create mode 100644 thousandeyes-sdk-instant-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-instant-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-internet-insights/test/conftest.py create mode 100644 thousandeyes-sdk-internet-insights/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-internet-insights/test/mock_manifest.py create mode 100644 thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py create mode 100644 thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py create mode 100644 thousandeyes-sdk-snapshots/test/conftest.py create mode 100644 thousandeyes-sdk-snapshots/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-snapshots/test/mock_manifest.py create mode 100644 thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py create mode 100644 thousandeyes-sdk-streaming/test/conftest.py create mode 100644 thousandeyes-sdk-streaming/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-streaming/test/mock_manifest.py create mode 100644 thousandeyes-sdk-streaming/test/test_streaming_api_integration.py create mode 100644 thousandeyes-sdk-tags/test/conftest.py create mode 100644 thousandeyes-sdk-tags/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-tags/test/mock_manifest.py create mode 100644 thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py create mode 100644 thousandeyes-sdk-tags/test/test_tags_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/conftest.py create mode 100644 thousandeyes-sdk-test-results/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-test-results/test/mock_manifest.py create mode 100644 thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/conftest.py create mode 100644 thousandeyes-sdk-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_api_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py create mode 100644 thousandeyes-sdk-usage/test/conftest.py create mode 100644 thousandeyes-sdk-usage/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-usage/test/mock_manifest.py create mode 100644 thousandeyes-sdk-usage/test/test_quotas_api_integration.py create mode 100644 thousandeyes-sdk-usage/test/test_usage_api_integration.py diff --git a/thousandeyes-sdk-administrative/test/conftest.py b/thousandeyes-sdk-administrative/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-administrative/test/integration_test_utils.py b/thousandeyes-sdk-administrative/test/integration_test_utils.py new file mode 100644 index 00000000..34cbcff5 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-administrative/test/mock_manifest.py b/thousandeyes-sdk-administrative/test/mock_manifest.py new file mode 100644 index 00000000..bfb0cf8e --- /dev/null +++ b/thousandeyes-sdk-administrative/test/mock_manifest.py @@ -0,0 +1,3252 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_account_group": OperationExpectation( + operation_id="create_account_group", + method="POST", + path="/account-groups", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """), + 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", + ), + + }, + ), + + "delete_account_group": OperationExpectation( + operation_id="delete_account_group", + method="DELETE", + path="/account-groups/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=204, + success_body=None, + 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", + ), + + }, + ), + + "get_account_group": OperationExpectation( + operation_id="get_account_group", + method="GET", + path="/account-groups/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_account_groups": OperationExpectation( + operation_id="get_account_groups", + method="GET", + path="/account-groups", + 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" + } + }, + "accountGroups" : [ { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" + }, { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" + } ] + } + + """), + + 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", + ), + + }, + ), + + "update_account_group": OperationExpectation( + operation_id="update_account_group", + method="PUT", + path="/account-groups/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """), + 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", + ), + + }, + ), + + "get_permissions": OperationExpectation( + operation_id="get_permissions", + method="GET", + path="/permissions", + 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" + } + }, + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ] + } + + """), + + 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", + ), + + }, + ), + + "create_role": OperationExpectation( + operation_id="create_role", + method="POST", + path="/roles", + 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" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """), + 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", + ), + + }, + ), + + "delete_role": OperationExpectation( + operation_id="delete_role", + method="DELETE", + path="/roles/{id}", + path_param_examples={ + "id": '23', + }, + success_status=204, + success_body=None, + 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", + ), + + }, + ), + + "get_role": OperationExpectation( + operation_id="get_role", + method="GET", + path="/roles/{id}", + path_param_examples={ + "id": '23', + }, + 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" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + + """), + + 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", + ), + + }, + ), + + "get_roles": OperationExpectation( + operation_id="get_roles", + method="GET", + path="/roles", + 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" + } + }, + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ] + } + + """), + + 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", + ), + + }, + ), + + "update_role": OperationExpectation( + operation_id="update_role", + method="PUT", + path="/roles/{id}", + path_param_examples={ + "id": '23', + }, + 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" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """), + 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", + ), + + }, + ), + + "get_user_events": OperationExpectation( + operation_id="get_user_events", + method="GET", + path="/audit-user-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" + }, + "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" + } + + """), + + 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", + ), + + }, + ), + + "create_user": OperationExpectation( + operation_id="create_user", + method="POST", + path="/users", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """), + 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", + ), + + }, + ), + + "delete_user": OperationExpectation( + operation_id="delete_user", + method="DELETE", + path="/users/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=204, + success_body=None, + 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", + ), + + }, + ), + + "get_current_user": OperationExpectation( + operation_id="get_current_user", + method="GET", + path="/users/current", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_user": OperationExpectation( + operation_id="get_user", + method="GET", + path="/users/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_users": OperationExpectation( + operation_id="get_users", + method="GET", + path="/users", + 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" + } + }, + "users" : [ { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + }, { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } ] + } + + """), + + 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", + ), + + }, + ), + + "update_user": OperationExpectation( + operation_id="update_user", + method="PUT", + path="/users/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """), + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py b/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py new file mode 100644 index 00000000..20d79a82 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py @@ -0,0 +1,1792 @@ +# 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.account_groups_api import AccountGroupsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAccountGroupsApiIntegration(IntegrationTestBase): + """AccountGroupsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AccountGroupsApi(self.api_client) + + + def test_create_account_group_happy_path(self) -> None: + """Integration test for create_account_group success path""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + response_body_json = """ + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_account_group_error_400(self) -> None: + """Integration test for create_account_group error path (HTTP 400)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_account_group_error_401(self) -> None: + """Integration test for create_account_group error path (HTTP 401)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_account_group_error_403(self) -> None: + """Integration test for create_account_group error path (HTTP 403)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_account_group_error_404(self) -> None: + """Integration test for create_account_group error path (HTTP 404)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.create_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_account_group_error_429(self) -> None: + """Integration test for create_account_group error path (HTTP 429)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_account_group_error_500(self) -> None: + """Integration test for create_account_group error path (HTTP 500)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("create_account_group", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_account_group_happy_path(self) -> None: + """Integration test for delete_account_group success path""" + id = '1234' + response = self.api.delete_account_group_with_http_info( + id=id, + _headers=self.te_headers("delete_account_group"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_account_group_error_400(self) -> None: + """Integration test for delete_account_group error path (HTTP 400)""" + id = '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.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_account_group_error_401(self) -> None: + """Integration test for delete_account_group error path (HTTP 401)""" + id = '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.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_account_group_error_403(self) -> None: + """Integration test for delete_account_group error path (HTTP 403)""" + id = '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.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_account_group_error_404(self) -> None: + """Integration test for delete_account_group error path (HTTP 404)""" + id = '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.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_account_group_error_429(self) -> None: + """Integration test for delete_account_group error path (HTTP 429)""" + id = '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.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_account_group_error_500(self) -> None: + """Integration test for delete_account_group error path (HTTP 500)""" + id = '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.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_account_group_happy_path(self) -> None: + """Integration test for get_account_group success path""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + response_body_json = """ + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_account_group_error_400(self) -> None: + """Integration test for get_account_group error path (HTTP 400)""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_group_error_401(self) -> None: + """Integration test for get_account_group error path (HTTP 401)""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_group_error_403(self) -> None: + """Integration test for get_account_group error path (HTTP 403)""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_group_error_404(self) -> None: + """Integration test for get_account_group error path (HTTP 404)""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_group_error_429(self) -> None: + """Integration test for get_account_group error path (HTTP 429)""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_group_error_500(self) -> None: + """Integration test for get_account_group error path (HTTP 500)""" + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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_account_group( + id=id, + expand=expand, + _headers=self.te_headers("get_account_group", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_account_groups_happy_path(self) -> None: + """Integration test for get_account_groups success path""" + 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" + } + }, + "accountGroups" : [ { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" + }, { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_account_groups( + _headers=self.te_headers("get_account_groups"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_account_groups_error_400(self) -> None: + """Integration test for get_account_groups error path (HTTP 400)""" + 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_account_groups( + _headers=self.te_headers("get_account_groups", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_groups_error_401(self) -> None: + """Integration test for get_account_groups error path (HTTP 401)""" + 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_account_groups( + _headers=self.te_headers("get_account_groups", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_groups_error_403(self) -> None: + """Integration test for get_account_groups error path (HTTP 403)""" + 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_account_groups( + _headers=self.te_headers("get_account_groups", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_groups_error_404(self) -> None: + """Integration test for get_account_groups error path (HTTP 404)""" + 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_account_groups( + _headers=self.te_headers("get_account_groups", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_groups_error_429(self) -> None: + """Integration test for get_account_groups error path (HTTP 429)""" + 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_account_groups( + _headers=self.te_headers("get_account_groups", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_account_groups_error_500(self) -> None: + """Integration test for get_account_groups error path (HTTP 500)""" + 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_account_groups( + _headers=self.te_headers("get_account_groups", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_account_group_happy_path(self) -> None: + """Integration test for update_account_group success path""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + response_body_json = """ + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "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" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_account_group_error_400(self) -> None: + """Integration test for update_account_group error path (HTTP 400)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_account_group_error_401(self) -> None: + """Integration test for update_account_group error path (HTTP 401)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_account_group_error_403(self) -> None: + """Integration test for update_account_group error path (HTTP 403)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_account_group_error_404(self) -> None: + """Integration test for update_account_group error path (HTTP 404)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_account_group_error_429(self) -> None: + """Integration test for update_account_group error path (HTTP 429)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_account_group_error_500(self) -> None: + """Integration test for update_account_group error path (HTTP 500)""" + request_body_json = """ + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """ + account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) + id = '1234' + expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] + 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.update_account_group( + id=id, + account_group_request=account_group_request, + expand=expand, + _headers=self.te_headers("update_account_group", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py b/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py new file mode 100644 index 00000000..4d4d91c8 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-administrative/test/test_roles_api_integration.py b/thousandeyes-sdk-administrative/test/test_roles_api_integration.py new file mode 100644 index 00000000..5958f187 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_roles_api_integration.py @@ -0,0 +1,1119 @@ +# 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.roles_api import RolesApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestRolesApiIntegration(IntegrationTestBase): + """RolesApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = RolesApi(self.api_client) + + + def test_create_role_happy_path(self) -> None: + """Integration test for create_role success path""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + 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" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_role_error_400(self) -> None: + """Integration test for create_role error path (HTTP 400)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.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_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_role_error_401(self) -> None: + """Integration test for create_role error path (HTTP 401)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.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_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_role_error_403(self) -> None: + """Integration test for create_role error path (HTTP 403)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.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_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_role_error_404(self) -> None: + """Integration test for create_role error path (HTTP 404)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.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.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_role_error_429(self) -> None: + """Integration test for create_role error path (HTTP 429)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.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_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_role_error_500(self) -> None: + """Integration test for create_role error path (HTTP 500)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.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_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_role_happy_path(self) -> None: + """Integration test for delete_role success path""" + id = '23' + aid = '1234' + response = self.api.delete_role_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_role"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_role_error_400(self) -> None: + """Integration test for delete_role error path (HTTP 400)""" + id = '23' + 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.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_role_error_401(self) -> None: + """Integration test for delete_role error path (HTTP 401)""" + id = '23' + 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.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_role_error_403(self) -> None: + """Integration test for delete_role error path (HTTP 403)""" + id = '23' + 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.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_role_error_404(self) -> None: + """Integration test for delete_role error path (HTTP 404)""" + id = '23' + 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.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_role_error_429(self) -> None: + """Integration test for delete_role error path (HTTP 429)""" + id = '23' + 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.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_role_error_500(self) -> None: + """Integration test for delete_role error path (HTTP 500)""" + id = '23' + 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.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_role_happy_path(self) -> None: + """Integration test for get_role success path""" + id = '23' + 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" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_role_error_400(self) -> None: + """Integration test for get_role error path (HTTP 400)""" + id = '23' + 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_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_role_error_401(self) -> None: + """Integration test for get_role error path (HTTP 401)""" + id = '23' + 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_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_role_error_403(self) -> None: + """Integration test for get_role error path (HTTP 403)""" + id = '23' + 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_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_role_error_404(self) -> None: + """Integration test for get_role error path (HTTP 404)""" + id = '23' + 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_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_role_error_429(self) -> None: + """Integration test for get_role error path (HTTP 429)""" + id = '23' + 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_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_role_error_500(self) -> None: + """Integration test for get_role error path (HTTP 500)""" + id = '23' + 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_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_roles_happy_path(self) -> None: + """Integration test for get_roles 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" + } + }, + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_roles_error_400(self) -> None: + """Integration test for get_roles 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_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_roles_error_401(self) -> None: + """Integration test for get_roles 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_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_roles_error_403(self) -> None: + """Integration test for get_roles 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_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_roles_error_404(self) -> None: + """Integration test for get_roles 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_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_roles_error_429(self) -> None: + """Integration test for get_roles 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_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_roles_error_500(self) -> None: + """Integration test for get_roles 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_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_role_happy_path(self) -> None: + """Integration test for update_role success path""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_role_error_400(self) -> None: + """Integration test for update_role error path (HTTP 400)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_role_error_401(self) -> None: + """Integration test for update_role error path (HTTP 401)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_role_error_403(self) -> None: + """Integration test for update_role error path (HTTP 403)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_role_error_404(self) -> None: + """Integration test for update_role error path (HTTP 404)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_role_error_429(self) -> None: + """Integration test for update_role error path (HTTP 429)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_role_error_500(self) -> None: + """Integration test for update_role error path (HTTP 500)""" + request_body_json = """ + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """ + role_request_body = thousandeyes_sdk.administrative.models.RoleRequestBody.from_json(request_body_json) + id = '23' + 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.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py b/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py new file mode 100644 index 00000000..e42f5677 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-administrative/test/test_users_api_integration.py b/thousandeyes-sdk-administrative/test/test_users_api_integration.py new file mode 100644 index 00000000..32d2afaf --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_users_api_integration.py @@ -0,0 +1,1583 @@ +# 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.users_api import UsersApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestUsersApiIntegration(IntegrationTestBase): + """UsersApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = UsersApi(self.api_client) + + + def test_create_user_happy_path(self) -> None: + """Integration test for create_user success path""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_user_error_400(self) -> None: + """Integration test for create_user error path (HTTP 400)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.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_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_user_error_401(self) -> None: + """Integration test for create_user error path (HTTP 401)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.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_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_user_error_403(self) -> None: + """Integration test for create_user error path (HTTP 403)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.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_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_user_error_404(self) -> None: + """Integration test for create_user error path (HTTP 404)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.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.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_user_error_429(self) -> None: + """Integration test for create_user error path (HTTP 429)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.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_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_user_error_500(self) -> None: + """Integration test for create_user error path (HTTP 500)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.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_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_user_happy_path(self) -> None: + """Integration test for delete_user success path""" + id = '1234' + aid = '1234' + response = self.api.delete_user_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_user"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_user_error_400(self) -> None: + """Integration test for delete_user error path (HTTP 400)""" + id = '1234' + 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.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_user_error_401(self) -> None: + """Integration test for delete_user error path (HTTP 401)""" + id = '1234' + 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.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_user_error_403(self) -> None: + """Integration test for delete_user error path (HTTP 403)""" + id = '1234' + 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.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_user_error_404(self) -> None: + """Integration test for delete_user error path (HTTP 404)""" + id = '1234' + 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.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_user_error_429(self) -> None: + """Integration test for delete_user error path (HTTP 429)""" + id = '1234' + 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.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_user_error_500(self) -> None: + """Integration test for delete_user error path (HTTP 500)""" + id = '1234' + 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.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_current_user_happy_path(self) -> None: + """Integration test for get_current_user success path""" + response_body_json = """ + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_current_user( + _headers=self.te_headers("get_current_user"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_current_user_error_400(self) -> None: + """Integration test for get_current_user error path (HTTP 400)""" + 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_current_user( + _headers=self.te_headers("get_current_user", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_current_user_error_401(self) -> None: + """Integration test for get_current_user error path (HTTP 401)""" + 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_current_user( + _headers=self.te_headers("get_current_user", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_current_user_error_403(self) -> None: + """Integration test for get_current_user error path (HTTP 403)""" + 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_current_user( + _headers=self.te_headers("get_current_user", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_current_user_error_404(self) -> None: + """Integration test for get_current_user error path (HTTP 404)""" + 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_current_user( + _headers=self.te_headers("get_current_user", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_current_user_error_429(self) -> None: + """Integration test for get_current_user error path (HTTP 429)""" + 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_current_user( + _headers=self.te_headers("get_current_user", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_current_user_error_500(self) -> None: + """Integration test for get_current_user error path (HTTP 500)""" + 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_current_user( + _headers=self.te_headers("get_current_user", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_user_happy_path(self) -> None: + """Integration test for get_user success path""" + id = '1234' + aid = '1234' + response_body_json = """ + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_user_error_400(self) -> None: + """Integration test for get_user error path (HTTP 400)""" + id = '1234' + 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_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_user_error_401(self) -> None: + """Integration test for get_user error path (HTTP 401)""" + id = '1234' + 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( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_user_error_403(self) -> None: + """Integration test for get_user error path (HTTP 403)""" + id = '1234' + 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_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_user_error_404(self) -> None: + """Integration test for get_user error path (HTTP 404)""" + id = '1234' + 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_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_user_error_429(self) -> None: + """Integration test for get_user error path (HTTP 429)""" + id = '1234' + 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_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_user_error_500(self) -> None: + """Integration test for get_user error path (HTTP 500)""" + id = '1234' + 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_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_users_happy_path(self) -> None: + """Integration test for get_users 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" + } + }, + "users" : [ { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + }, { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_users_error_400(self) -> None: + """Integration test for get_users 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_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_users_error_401(self) -> None: + """Integration test for get_users 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_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_users_error_403(self) -> None: + """Integration test for get_users 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_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_users_error_404(self) -> None: + """Integration test for get_users 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_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_users_error_429(self) -> None: + """Integration test for get_users 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_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_users_error_500(self) -> None: + """Integration test for get_users 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_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_user_happy_path(self) -> None: + """Integration test for update_user success path""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + aid = '1234' + response_body_json = """ + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_user_error_400(self) -> None: + """Integration test for update_user error path (HTTP 400)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + 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.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_user_error_401(self) -> None: + """Integration test for update_user error path (HTTP 401)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + 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.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_user_error_403(self) -> None: + """Integration test for update_user error path (HTTP 403)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + 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.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_user_error_404(self) -> None: + """Integration test for update_user error path (HTTP 404)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + 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.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_user_error_429(self) -> None: + """Integration test for update_user error path (HTTP 429)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + 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.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_user_error_500(self) -> None: + """Integration test for update_user error path (HTTP 500)""" + request_body_json = """ + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """ + user_request = thousandeyes_sdk.administrative.models.UserRequest.from_json(request_body_json) + id = '1234' + 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.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-agents/test/conftest.py b/thousandeyes-sdk-agents/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-agents/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-agents/test/integration_test_utils.py b/thousandeyes-sdk-agents/test/integration_test_utils.py new file mode 100644 index 00000000..7813e966 --- /dev/null +++ b/thousandeyes-sdk-agents/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-agents/test/mock_manifest.py b/thousandeyes-sdk-agents/test/mock_manifest.py new file mode 100644 index 00000000..2007d92e --- /dev/null +++ b/thousandeyes-sdk-agents/test/mock_manifest.py @@ -0,0 +1,2459 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_agents_proxies": OperationExpectation( + operation_id="get_agents_proxies", + method="GET", + path="/agents/proxies", + 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" + } + }, + "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" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents_notification_rule": OperationExpectation( + operation_id="get_agents_notification_rule", + method="GET", + path="/agents/notification-rules/{notificationRuleId}", + path_param_examples={ + "notificationRuleId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents_notification_rules": OperationExpectation( + operation_id="get_agents_notification_rules", + method="GET", + path="/agents/notification-rules", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + } + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent": OperationExpectation( + operation_id="delete_agent", + method="DELETE", + path="/agents/{agentId}", + path_param_examples={ + "agentId": '281474976710706', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent": OperationExpectation( + operation_id="get_agent", + method="GET", + path="/agents/{agentId}", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents": OperationExpectation( + operation_id="get_agents", + method="GET", + path="/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" + } + }, + "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 + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent": OperationExpectation( + operation_id="update_agent", + method="PUT", + path="/agents/{agentId}", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_agent_to_cluster": OperationExpectation( + operation_id="assign_agent_to_cluster", + method="POST", + path="/agents/{agentId}/cluster/assign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "agents" : [ "281474976710706" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_agent_from_cluster": OperationExpectation( + operation_id="unassign_agent_from_cluster", + method="POST", + path="/agents/{agentId}/cluster/unassign", + path_param_examples={ + "agentId": '281474976710706', + }, + 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" + } + }, + "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 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "members" : [ "281474976710706" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents_local_problems": OperationExpectation( + operation_id="get_agents_local_problems", + method="GET", + path="/agents/local-problems", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_tests": OperationExpectation( + operation_id="assign_tests", + method="POST", + path="/agents/{agentId}/tests/assign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "testIds" : [ "281474976710706" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "overwrite_tests": OperationExpectation( + operation_id="overwrite_tests", + method="POST", + path="/agents/{agentId}/tests/override", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "testIds" : [ "281474976710706" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_tests": OperationExpectation( + operation_id="unassign_tests", + method="POST", + path="/agents/{agentId}/tests/unassign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "testIds" : [ "281474976710706" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py b/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py new file mode 100644 index 00000000..5c025461 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py new file mode 100644 index 00000000..a8d48b55 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py new file mode 100644 index 00000000..f7ecdc5d --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py @@ -0,0 +1,1206 @@ +# 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_agents_api import CloudAndEnterpriseAgentsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): + """CloudAndEnterpriseAgentsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = CloudAndEnterpriseAgentsApi(self.api_client) + + + def test_delete_agent_happy_path(self) -> None: + """Integration test for delete_agent success path""" + agent_id = '281474976710706' + aid = '1234' + response = self.api.delete_agent_with_http_info( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_agent_error_401(self) -> None: + """Integration test for delete_agent error path (HTTP 401)""" + agent_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.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_error_403(self) -> None: + """Integration test for delete_agent error path (HTTP 403)""" + agent_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.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_error_404(self) -> None: + """Integration test for delete_agent error path (HTTP 404)""" + agent_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.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_error_429(self) -> None: + """Integration test for delete_agent error path (HTTP 429)""" + agent_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.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_error_500(self) -> None: + """Integration test for delete_agent error path (HTTP 500)""" + agent_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.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_error_502(self) -> None: + """Integration test for delete_agent error path (HTTP 502)""" + agent_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.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_happy_path(self) -> None: + """Integration test for get_agent success path""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_error_401(self) -> None: + """Integration test for get_agent error path (HTTP 401)""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_error_403(self) -> None: + """Integration test for get_agent error path (HTTP 403)""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_error_404(self) -> None: + """Integration test for get_agent error path (HTTP 404)""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_error_429(self) -> None: + """Integration test for get_agent error path (HTTP 429)""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_error_500(self) -> None: + """Integration test for get_agent error path (HTTP 500)""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_error_502(self) -> None: + """Integration test for get_agent error path (HTTP 502)""" + 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.get_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_agent", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agents_happy_path(self) -> None: + """Integration test for get_agents success path""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_example'] + 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.get_agents( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agents_error_401(self) -> None: + """Integration test for get_agents error path (HTTP 401)""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_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_agents( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agents_error_403(self) -> None: + """Integration test for get_agents error path (HTTP 403)""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_example'] + 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( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agents_error_404(self) -> None: + """Integration test for get_agents error path (HTTP 404)""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_example'] + 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( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agents_error_429(self) -> None: + """Integration test for get_agents error path (HTTP 429)""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_example'] + 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( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agents_error_500(self) -> None: + """Integration test for get_agents error path (HTTP 500)""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_example'] + 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( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agents_error_502(self) -> None: + """Integration test for get_agents error path (HTTP 502)""" + aid = '1234' + expand = [thousandeyes_sdk.agents.AgentListExpand()] + agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] + labels = ['[\"myCustomLabeledAgent\"]'] + tag_keys = ['tag_keys_example'] + 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( + aid=aid, + expand=expand, + agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_agent_happy_path(self) -> None: + """Integration test for update_agent success path""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_agent_error_400(self) -> None: + """Integration test for update_agent error path (HTTP 400)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_error_401(self) -> None: + """Integration test for update_agent error path (HTTP 401)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_error_403(self) -> None: + """Integration test for update_agent error path (HTTP 403)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_error_404(self) -> None: + """Integration test for update_agent error path (HTTP 404)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_error_429(self) -> None: + """Integration test for update_agent error path (HTTP 429)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_error_500(self) -> None: + """Integration test for update_agent error path (HTTP 500)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_error_502(self) -> None: + """Integration test for update_agent error path (HTTP 502)""" + request_body_json = """ + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """ + agent_request = thousandeyes_sdk.agents.models.AgentRequest.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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py b/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py new file mode 100644 index 00000000..424f1db2 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py b/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py new file mode 100644 index 00000000..d64ffb51 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py b/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py new file mode 100644 index 00000000..c1f32dc9 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py @@ -0,0 +1,1184 @@ +# 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.tests_assignment_on_agents_api import TestsAssignmentOnAgentsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): + """TestsAssignmentOnAgentsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = TestsAssignmentOnAgentsApi(self.api_client) + + + def test_assign_tests_happy_path(self) -> None: + """Integration test for assign_tests success path""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_id = '281474976710706' + aid = '1234' + 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_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_assign_tests_error_400(self) -> None: + """Integration test for assign_tests error path (HTTP 400)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_id = '281474976710706' + 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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tests_error_401(self) -> None: + """Integration test for assign_tests error path (HTTP 401)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tests_error_403(self) -> None: + """Integration test for assign_tests error path (HTTP 403)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tests_error_404(self) -> None: + """Integration test for assign_tests error path (HTTP 404)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tests_error_429(self) -> None: + """Integration test for assign_tests error path (HTTP 429)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tests_error_500(self) -> None: + """Integration test for assign_tests error path (HTTP 500)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tests_error_502(self) -> None: + """Integration test for assign_tests error path (HTTP 502)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_overwrite_tests_happy_path(self) -> None: + """Integration test for overwrite_tests success path""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_id = '281474976710706' + aid = '1234' + 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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_overwrite_tests_error_400(self) -> None: + """Integration test for overwrite_tests error path (HTTP 400)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_id = '281474976710706' + 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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_overwrite_tests_error_401(self) -> None: + """Integration test for overwrite_tests error path (HTTP 401)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_overwrite_tests_error_403(self) -> None: + """Integration test for overwrite_tests error path (HTTP 403)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_overwrite_tests_error_404(self) -> None: + """Integration test for overwrite_tests error path (HTTP 404)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_overwrite_tests_error_429(self) -> None: + """Integration test for overwrite_tests error path (HTTP 429)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_overwrite_tests_error_500(self) -> None: + """Integration test for overwrite_tests error path (HTTP 500)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_overwrite_tests_error_502(self) -> None: + """Integration test for overwrite_tests error path (HTTP 502)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_unassign_tests_happy_path(self) -> None: + """Integration test for unassign_tests success path""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_id = '281474976710706' + aid = '1234' + 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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_unassign_tests_error_400(self) -> None: + """Integration test for unassign_tests error path (HTTP 400)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_id = '281474976710706' + 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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tests_error_401(self) -> None: + """Integration test for unassign_tests error path (HTTP 401)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tests_error_403(self) -> None: + """Integration test for unassign_tests error path (HTTP 403)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tests_error_404(self) -> None: + """Integration test for unassign_tests error path (HTTP 404)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tests_error_429(self) -> None: + """Integration test for unassign_tests error path (HTTP 429)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tests_error_500(self) -> None: + """Integration test for unassign_tests error path (HTTP 500)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tests_error_502(self) -> None: + """Integration test for unassign_tests error path (HTTP 502)""" + request_body_json = """ + + { + "testIds" : [ "281474976710706" ] + } + + """ + agent_tests_assign_request = thousandeyes_sdk.agents.models.AgentTestsAssignRequest.from_json(request_body_json) + agent_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.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-alerts/test/conftest.py b/thousandeyes-sdk-alerts/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-alerts/test/integration_test_utils.py b/thousandeyes-sdk-alerts/test/integration_test_utils.py new file mode 100644 index 00000000..24b37d08 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-alerts/test/mock_manifest.py b/thousandeyes-sdk-alerts/test/mock_manifest.py new file mode 100644 index 00000000..b1d811c7 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/mock_manifest.py @@ -0,0 +1,2247 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_alert_rule": OperationExpectation( + operation_id="create_alert_rule", + method="POST", + path="/alerts/rules", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + 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_alert_rule": OperationExpectation( + operation_id="delete_alert_rule", + method="DELETE", + path="/alerts/rules/{ruleId}", + path_param_examples={ + "ruleId": '127094', + }, + success_status=204, + success_body=None, + 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_alert_rule": OperationExpectation( + operation_id="get_alert_rule", + method="GET", + path="/alerts/rules/{ruleId}", + path_param_examples={ + "ruleId": '127094', + }, + success_status=200, + success_body=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "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" + } ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + + 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_alerts_rules": OperationExpectation( + operation_id="get_alerts_rules", + method="GET", + path="/alerts/rules", + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ] + } + + """), + + 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_alert_rule": OperationExpectation( + operation_id="update_alert_rule", + method="PUT", + path="/alerts/rules/{ruleId}", + path_param_examples={ + "ruleId": '127094', + }, + success_status=200, + success_body=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + 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", + ), + + }, + ), + + "create_alert_suppression_window": OperationExpectation( + operation_id="create_alert_suppression_window", + method="POST", + path="/alert-suppression-windows", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "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" + } ], + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + 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_alert_suppression_window": OperationExpectation( + operation_id="delete_alert_suppression_window", + method="DELETE", + path="/alert-suppression-windows/{windowId}", + path_param_examples={ + "windowId": '2411', + }, + success_status=204, + success_body=None, + 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_alert_suppression_window": OperationExpectation( + operation_id="get_alert_suppression_window", + method="GET", + path="/alert-suppression-windows/{windowId}", + path_param_examples={ + "windowId": '2411', + }, + success_status=200, + success_body=json.loads(""" + + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "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" + } ], + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + + 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_alert_suppression_windows": OperationExpectation( + operation_id="get_alert_suppression_windows", + method="GET", + path="/alert-suppression-windows", + 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" + } + }, + "alertSuppressionWindows" : [ { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + }, { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } ] + } + + """), + + 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_alert_suppression_window": OperationExpectation( + operation_id="update_alert_suppression_window", + method="PUT", + path="/alert-suppression-windows/{windowId}", + path_param_examples={ + "windowId": '2411', + }, + success_status=200, + success_body=json.loads(""" + + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "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" + } ], + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + 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_alert": OperationExpectation( + operation_id="get_alert", + method="GET", + path="/alerts/{alertId}", + path_param_examples={ + "alertId": 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + + """), + + 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_alerts": OperationExpectation( + operation_id="get_alerts", + method="GET", + path="/alerts", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + } + } + + """), + + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py b/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py new file mode 100644 index 00000000..dd34a8cc --- /dev/null +++ b/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py @@ -0,0 +1,2030 @@ +# 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.alert_rules_api import AlertRulesApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAlertRulesApiIntegration(IntegrationTestBase): + """AlertRulesApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AlertRulesApi(self.api_client) + + + def test_create_alert_rule_happy_path(self) -> None: + """Integration test for create_alert_rule success path""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_alert_rule_error_400(self) -> None: + """Integration test for create_alert_rule error path (HTTP 400)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.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_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_rule_error_401(self) -> None: + """Integration test for create_alert_rule error path (HTTP 401)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.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_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_rule_error_403(self) -> None: + """Integration test for create_alert_rule error path (HTTP 403)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.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_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_rule_error_404(self) -> None: + """Integration test for create_alert_rule error path (HTTP 404)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.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_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_rule_error_429(self) -> None: + """Integration test for create_alert_rule error path (HTTP 429)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.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_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_rule_error_500(self) -> None: + """Integration test for create_alert_rule error path (HTTP 500)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.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_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_alert_rule_happy_path(self) -> None: + """Integration test for delete_alert_rule success path""" + rule_id = '127094' + aid = '1234' + response = self.api.delete_alert_rule_with_http_info( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_alert_rule_error_400(self) -> None: + """Integration test for delete_alert_rule error path (HTTP 400)""" + rule_id = '127094' + 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.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_rule_error_401(self) -> None: + """Integration test for delete_alert_rule error path (HTTP 401)""" + rule_id = '127094' + 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.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_rule_error_403(self) -> None: + """Integration test for delete_alert_rule error path (HTTP 403)""" + rule_id = '127094' + 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.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_rule_error_404(self) -> None: + """Integration test for delete_alert_rule error path (HTTP 404)""" + rule_id = '127094' + 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.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_rule_error_429(self) -> None: + """Integration test for delete_alert_rule error path (HTTP 429)""" + rule_id = '127094' + 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.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_rule_error_500(self) -> None: + """Integration test for delete_alert_rule error path (HTTP 500)""" + rule_id = '127094' + 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.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_alert_rule_happy_path(self) -> None: + """Integration test for get_alert_rule success path""" + rule_id = '127094' + aid = '1234' + response_body_json = """ + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "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" + } ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_alert_rule_error_401(self) -> None: + """Integration test for get_alert_rule error path (HTTP 401)""" + rule_id = '127094' + 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_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_rule_error_403(self) -> None: + """Integration test for get_alert_rule error path (HTTP 403)""" + rule_id = '127094' + 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_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_rule_error_404(self) -> None: + """Integration test for get_alert_rule error path (HTTP 404)""" + rule_id = '127094' + 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_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_rule_error_429(self) -> None: + """Integration test for get_alert_rule error path (HTTP 429)""" + rule_id = '127094' + 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_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_rule_error_500(self) -> None: + """Integration test for get_alert_rule error path (HTTP 500)""" + rule_id = '127094' + 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_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_alerts_rules_happy_path(self) -> None: + """Integration test for get_alerts_rules 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_alerts_rules_error_401(self) -> None: + """Integration test for get_alerts_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_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alerts_rules_error_403(self) -> None: + """Integration test for get_alerts_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_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alerts_rules_error_404(self) -> None: + """Integration test for get_alerts_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_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alerts_rules_error_429(self) -> None: + """Integration test for get_alerts_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_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alerts_rules_error_500(self) -> None: + """Integration test for get_alerts_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_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_alert_rule_happy_path(self) -> None: + """Integration test for update_alert_rule success path""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + aid = '1234' + response_body_json = """ + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_alert_rule_error_400(self) -> None: + """Integration test for update_alert_rule error path (HTTP 400)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + 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.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_rule_error_401(self) -> None: + """Integration test for update_alert_rule error path (HTTP 401)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + 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.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_rule_error_403(self) -> None: + """Integration test for update_alert_rule error path (HTTP 403)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + 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.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_rule_error_404(self) -> None: + """Integration test for update_alert_rule error path (HTTP 404)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + 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.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_rule_error_429(self) -> None: + """Integration test for update_alert_rule error path (HTTP 429)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + 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.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_rule_error_500(self) -> None: + """Integration test for update_alert_rule error path (HTTP 500)""" + request_body_json = """ + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """ + rule_detail_update = thousandeyes_sdk.alerts.models.RuleDetailUpdate.from_json(request_body_json) + rule_id = '127094' + 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.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py b/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py new file mode 100644 index 00000000..aac6b9f7 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py @@ -0,0 +1,1565 @@ +# 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.alert_suppression_windows_api import AlertSuppressionWindowsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): + """AlertSuppressionWindowsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AlertSuppressionWindowsApi(self.api_client) + + + def test_create_alert_suppression_window_happy_path(self) -> None: + """Integration test for create_alert_suppression_window success path""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + response_body_json = """ + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "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" + } ], + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_alert_suppression_window_error_400(self) -> None: + """Integration test for create_alert_suppression_window error path (HTTP 400)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_suppression_window_error_401(self) -> None: + """Integration test for create_alert_suppression_window error path (HTTP 401)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_suppression_window_error_403(self) -> None: + """Integration test for create_alert_suppression_window error path (HTTP 403)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_suppression_window_error_404(self) -> None: + """Integration test for create_alert_suppression_window error path (HTTP 404)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_suppression_window_error_429(self) -> None: + """Integration test for create_alert_suppression_window error path (HTTP 429)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_alert_suppression_window_error_500(self) -> None: + """Integration test for create_alert_suppression_window error path (HTTP 500)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_alert_suppression_window_happy_path(self) -> None: + """Integration test for delete_alert_suppression_window success path""" + window_id = '2411' + aid = '1234' + response = self.api.delete_alert_suppression_window_with_http_info( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_alert_suppression_window_error_400(self) -> None: + """Integration test for delete_alert_suppression_window error path (HTTP 400)""" + window_id = '2411' + 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.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_suppression_window_error_401(self) -> None: + """Integration test for delete_alert_suppression_window error path (HTTP 401)""" + window_id = '2411' + 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.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_suppression_window_error_403(self) -> None: + """Integration test for delete_alert_suppression_window error path (HTTP 403)""" + window_id = '2411' + 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.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_suppression_window_error_404(self) -> None: + """Integration test for delete_alert_suppression_window error path (HTTP 404)""" + window_id = '2411' + 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.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_suppression_window_error_429(self) -> None: + """Integration test for delete_alert_suppression_window error path (HTTP 429)""" + window_id = '2411' + 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.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_alert_suppression_window_error_500(self) -> None: + """Integration test for delete_alert_suppression_window error path (HTTP 500)""" + window_id = '2411' + 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.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_alert_suppression_window_happy_path(self) -> None: + """Integration test for get_alert_suppression_window success path""" + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + response_body_json = """ + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "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" + } ], + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_alert_suppression_window"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_alert_suppression_window_error_401(self) -> None: + """Integration test for get_alert_suppression_window error path (HTTP 401)""" + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_suppression_window( + window_id=window_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_window_error_403(self) -> None: + """Integration test for get_alert_suppression_window error path (HTTP 403)""" + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_suppression_window( + window_id=window_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_window_error_404(self) -> None: + """Integration test for get_alert_suppression_window error path (HTTP 404)""" + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_suppression_window( + window_id=window_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_window_error_429(self) -> None: + """Integration test for get_alert_suppression_window error path (HTTP 429)""" + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_suppression_window( + window_id=window_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_window_error_500(self) -> None: + """Integration test for get_alert_suppression_window error path (HTTP 500)""" + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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_suppression_window( + window_id=window_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_alert_suppression_windows_happy_path(self) -> None: + """Integration test for get_alert_suppression_windows 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" + } + }, + "alertSuppressionWindows" : [ { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + }, { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_alert_suppression_windows_error_401(self) -> None: + """Integration test for get_alert_suppression_windows 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_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_windows_error_403(self) -> None: + """Integration test for get_alert_suppression_windows 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_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_windows_error_404(self) -> None: + """Integration test for get_alert_suppression_windows 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_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_windows_error_429(self) -> None: + """Integration test for get_alert_suppression_windows 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_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_alert_suppression_windows_error_500(self) -> None: + """Integration test for get_alert_suppression_windows 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_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_alert_suppression_window_happy_path(self) -> None: + """Integration test for update_alert_suppression_window success path""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + response_body_json = """ + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "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" + } ], + "_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" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_alert_suppression_window_error_400(self) -> None: + """Integration test for update_alert_suppression_window error path (HTTP 400)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_suppression_window_error_401(self) -> None: + """Integration test for update_alert_suppression_window error path (HTTP 401)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_suppression_window_error_403(self) -> None: + """Integration test for update_alert_suppression_window error path (HTTP 403)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_suppression_window_error_404(self) -> None: + """Integration test for update_alert_suppression_window error path (HTTP 404)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_suppression_window_error_429(self) -> None: + """Integration test for update_alert_suppression_window error path (HTTP 429)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_alert_suppression_window_error_500(self) -> None: + """Integration test for update_alert_suppression_window error path (HTTP 500)""" + request_body_json = """ + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """ + alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) + window_id = '2411' + aid = '1234' + expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] + 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.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py b/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py new file mode 100644 index 00000000..4632a7a8 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-connectors/test/conftest.py b/thousandeyes-sdk-connectors/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-connectors/test/integration_test_utils.py b/thousandeyes-sdk-connectors/test/integration_test_utils.py new file mode 100644 index 00000000..c05e4aa3 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-connectors/test/mock_manifest.py b/thousandeyes-sdk-connectors/test/mock_manifest.py new file mode 100644 index 00000000..8ed9fbdb --- /dev/null +++ b/thousandeyes-sdk-connectors/test/mock_manifest.py @@ -0,0 +1,3021 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_credential_vault_operation": OperationExpectation( + operation_id="create_credential_vault_operation", + method="POST", + path="/operations/credential-vault", + 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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_credential_vault_operation": OperationExpectation( + operation_id="delete_credential_vault_operation", + method="DELETE", + path="/operations/credential-vault/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_credential_vault_operation": OperationExpectation( + operation_id="get_credential_vault_operation", + method="GET", + path="/operations/credential-vault/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + 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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_credential_vault_operations": OperationExpectation( + operation_id="get_credential_vault_operations", + method="GET", + path="/operations/credential-vault", + 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" + } + }, + "items" : [ { + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + }, { + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_credential_vault_operation": OperationExpectation( + operation_id="update_credential_vault_operation", + method="PUT", + path="/operations/credential-vault/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + 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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_conjur_connector": OperationExpectation( + operation_id="create_conjur_connector", + method="POST", + path="/connectors/conjur", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_conjur_connector": OperationExpectation( + operation_id="delete_conjur_connector", + method="DELETE", + path="/connectors/conjur/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_conjur_connector": OperationExpectation( + operation_id="get_conjur_connector", + method="GET", + path="/connectors/conjur/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_conjur_connector_operations": OperationExpectation( + operation_id="get_conjur_connector_operations", + method="GET", + path="/connectors/conjur/{id}/operations", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + 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" + } + }, + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_conjur_connectors": OperationExpectation( + operation_id="get_conjur_connectors", + method="GET", + path="/connectors/conjur", + 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" + } + }, + "items" : [ { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + }, { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_conjur_connector": OperationExpectation( + operation_id="update_conjur_connector", + method="PUT", + path="/connectors/conjur/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_generic_connector": OperationExpectation( + operation_id="create_generic_connector", + method="POST", + path="/connectors/generic", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_generic_connector": OperationExpectation( + operation_id="delete_generic_connector", + method="DELETE", + path="/connectors/generic/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_generic_connector": OperationExpectation( + operation_id="get_generic_connector", + method="GET", + path="/connectors/generic/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_generic_connectors": OperationExpectation( + operation_id="get_generic_connectors", + method="GET", + path="/connectors/generic", + 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" + } + }, + "items" : [ { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + }, { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "list_generic_connector_operations": OperationExpectation( + operation_id="list_generic_connector_operations", + method="GET", + path="/connectors/generic/{id}/operations", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + 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" + } + }, + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_generic_connector": OperationExpectation( + operation_id="update_generic_connector", + method="PUT", + path="/connectors/generic/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_operation_connectors": OperationExpectation( + operation_id="get_operation_connectors", + method="GET", + path="/operations/{type}/{id}/connectors", + path_param_examples={ + "type": 'webhooks', + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + 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" + } + }, + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_webhook_operation": OperationExpectation( + operation_id="create_webhook_operation", + method="POST", + path="/operations/webhooks", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_webhook_operation": OperationExpectation( + operation_id="delete_webhook_operation", + method="DELETE", + path="/operations/webhooks/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_webhook_operation": OperationExpectation( + operation_id="get_webhook_operation", + method="GET", + path="/operations/webhooks/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_webhook_operations": OperationExpectation( + operation_id="get_webhook_operations", + method="GET", + path="/operations/webhooks", + 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" + } + }, + "items" : [ { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + }, { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_webhook_operation": OperationExpectation( + operation_id="update_webhook_operation", + method="PUT", + path="/operations/webhooks/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py new file mode 100644 index 00000000..652ff738 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py @@ -0,0 +1,1305 @@ +# 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.credential_vault_operations_api import CredentialVaultOperationsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): + """CredentialVaultOperationsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = CredentialVaultOperationsApi(self.api_client) + + + def test_create_credential_vault_operation_happy_path(self) -> None: + """Integration test for create_credential_vault_operation success path""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_credential_vault_operation_error_400(self) -> None: + """Integration test for create_credential_vault_operation error path (HTTP 400)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.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_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_vault_operation_error_401(self) -> None: + """Integration test for create_credential_vault_operation error path (HTTP 401)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.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_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_vault_operation_error_403(self) -> None: + """Integration test for create_credential_vault_operation error path (HTTP 403)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.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_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_vault_operation_error_404(self) -> None: + """Integration test for create_credential_vault_operation error path (HTTP 404)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.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.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_vault_operation_error_500(self) -> None: + """Integration test for create_credential_vault_operation error path (HTTP 500)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.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_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_credential_vault_operation_happy_path(self) -> None: + """Integration test for delete_credential_vault_operation success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + aid = '1234' + response = self.api.delete_credential_vault_operation_with_http_info( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_credential_vault_operation_error_400(self) -> None: + """Integration test for delete_credential_vault_operation error path (HTTP 400)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_vault_operation_error_401(self) -> None: + """Integration test for delete_credential_vault_operation error path (HTTP 401)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_vault_operation_error_403(self) -> None: + """Integration test for delete_credential_vault_operation error path (HTTP 403)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_vault_operation_error_404(self) -> None: + """Integration test for delete_credential_vault_operation error path (HTTP 404)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_vault_operation_error_500(self) -> None: + """Integration test for delete_credential_vault_operation error path (HTTP 500)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_credential_vault_operation_happy_path(self) -> None: + """Integration test for get_credential_vault_operation success path""" + 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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_credential_vault_operation_error_400(self) -> None: + """Integration test for get_credential_vault_operation error path (HTTP 400)""" + 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_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operation_error_401(self) -> None: + """Integration test for get_credential_vault_operation error path (HTTP 401)""" + 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_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operation_error_403(self) -> None: + """Integration test for get_credential_vault_operation error path (HTTP 403)""" + 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_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operation_error_404(self) -> None: + """Integration test for get_credential_vault_operation error path (HTTP 404)""" + 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_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operation_error_500(self) -> None: + """Integration test for get_credential_vault_operation error path (HTTP 500)""" + 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_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_credential_vault_operations_happy_path(self) -> None: + """Integration test for get_credential_vault_operations 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" + } + }, + "items" : [ { + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + }, { + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_credential_vault_operations_error_400(self) -> None: + """Integration test for get_credential_vault_operations 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_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operations_error_401(self) -> None: + """Integration test for get_credential_vault_operations 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_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operations_error_403(self) -> None: + """Integration test for get_credential_vault_operations 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_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operations_error_404(self) -> None: + """Integration test for get_credential_vault_operations 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_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_vault_operations_error_500(self) -> None: + """Integration test for get_credential_vault_operations 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_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_credential_vault_operation_happy_path(self) -> None: + """Integration test for update_credential_vault_operation success path""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_credential_vault_operation_error_400(self) -> None: + """Integration test for update_credential_vault_operation error path (HTTP 400)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_vault_operation_error_401(self) -> None: + """Integration test for update_credential_vault_operation error path (HTTP 401)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_vault_operation_error_403(self) -> None: + """Integration test for update_credential_vault_operation error path (HTTP 403)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_vault_operation_error_404(self) -> None: + """Integration test for update_credential_vault_operation error path (HTTP 404)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_vault_operation_error_500(self) -> None: + """Integration test for update_credential_vault_operation error path (HTTP 500)""" + request_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" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """ + credential_vault_operation = thousandeyes_sdk.connectors.models.CredentialVaultOperation.from_json(request_body_json) + 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.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py new file mode 100644 index 00000000..d46700da --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py @@ -0,0 +1,1434 @@ +# 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.cyber_ark_conjur_connectors_api import CyberArkConjurConnectorsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): + """CyberArkConjurConnectorsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = CyberArkConjurConnectorsApi(self.api_client) + + + def test_create_conjur_connector_happy_path(self) -> None: + """Integration test for create_conjur_connector success path""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_conjur_connector_error_400(self) -> None: + """Integration test for create_conjur_connector error path (HTTP 400)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.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_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_conjur_connector_error_401(self) -> None: + """Integration test for create_conjur_connector error path (HTTP 401)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.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_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_conjur_connector_error_403(self) -> None: + """Integration test for create_conjur_connector error path (HTTP 403)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.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_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_conjur_connector_error_404(self) -> None: + """Integration test for create_conjur_connector error path (HTTP 404)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.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.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_conjur_connector_error_500(self) -> None: + """Integration test for create_conjur_connector error path (HTTP 500)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.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_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_conjur_connector_happy_path(self) -> None: + """Integration test for delete_conjur_connector success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + aid = '1234' + response = self.api.delete_conjur_connector_with_http_info( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_conjur_connector_error_400(self) -> None: + """Integration test for delete_conjur_connector error path (HTTP 400)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_conjur_connector_error_401(self) -> None: + """Integration test for delete_conjur_connector error path (HTTP 401)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_conjur_connector_error_403(self) -> None: + """Integration test for delete_conjur_connector error path (HTTP 403)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_conjur_connector_error_404(self) -> None: + """Integration test for delete_conjur_connector error path (HTTP 404)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_conjur_connector_error_500(self) -> None: + """Integration test for delete_conjur_connector error path (HTTP 500)""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + confirm_disabled_objects = False + 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.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_conjur_connector_happy_path(self) -> None: + """Integration test for get_conjur_connector success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response_body_json = """ + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_conjur_connector_error_400(self) -> None: + """Integration test for get_conjur_connector error path (HTTP 400)""" + 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_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_error_401(self) -> None: + """Integration test for get_conjur_connector error path (HTTP 401)""" + 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_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_error_403(self) -> None: + """Integration test for get_conjur_connector error path (HTTP 403)""" + 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_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_error_404(self) -> None: + """Integration test for get_conjur_connector error path (HTTP 404)""" + 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_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_error_500(self) -> None: + """Integration test for get_conjur_connector error path (HTTP 500)""" + 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_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_conjur_connector_operations_happy_path(self) -> None: + """Integration test for get_conjur_connector_operations success path""" + 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_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_conjur_connector_operations_error_400(self) -> None: + """Integration test for get_conjur_connector_operations error path (HTTP 400)""" + 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_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_operations_error_401(self) -> None: + """Integration test for get_conjur_connector_operations error path (HTTP 401)""" + 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_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_operations_error_403(self) -> None: + """Integration test for get_conjur_connector_operations error path (HTTP 403)""" + 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_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_operations_error_404(self) -> None: + """Integration test for get_conjur_connector_operations error path (HTTP 404)""" + 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_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connector_operations_error_500(self) -> None: + """Integration test for get_conjur_connector_operations error path (HTTP 500)""" + 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_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_conjur_connectors_happy_path(self) -> None: + """Integration test for get_conjur_connectors 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" + } + }, + "items" : [ { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + }, { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_conjur_connectors_error_400(self) -> None: + """Integration test for get_conjur_connectors 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_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connectors_error_401(self) -> None: + """Integration test for get_conjur_connectors 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_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connectors_error_403(self) -> None: + """Integration test for get_conjur_connectors 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_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connectors_error_404(self) -> None: + """Integration test for get_conjur_connectors 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_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_conjur_connectors_error_500(self) -> None: + """Integration test for get_conjur_connectors 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_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_conjur_connector_happy_path(self) -> None: + """Integration test for update_conjur_connector success path""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response_body_json = """ + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_conjur_connector_error_400(self) -> None: + """Integration test for update_conjur_connector error path (HTTP 400)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + 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.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_conjur_connector_error_401(self) -> None: + """Integration test for update_conjur_connector error path (HTTP 401)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + 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.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_conjur_connector_error_403(self) -> None: + """Integration test for update_conjur_connector error path (HTTP 403)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + 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.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_conjur_connector_error_404(self) -> None: + """Integration test for update_conjur_connector error path (HTTP 404)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + 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.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_conjur_connector_error_500(self) -> None: + """Integration test for update_conjur_connector error path (HTTP 500)""" + request_body_json = """ + + { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """ + conjur_connector = thousandeyes_sdk.connectors.models.ConjurConnector.from_json(request_body_json) + 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.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py new file mode 100644 index 00000000..036a1f08 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py @@ -0,0 +1,1524 @@ +# 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.generic_connectors_api import GenericConnectorsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestGenericConnectorsApiIntegration(IntegrationTestBase): + """GenericConnectorsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = GenericConnectorsApi(self.api_client) + + + def test_create_generic_connector_happy_path(self) -> None: + """Integration test for create_generic_connector success path""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_generic_connector_error_400(self) -> None: + """Integration test for create_generic_connector error path (HTTP 400)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.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_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_generic_connector_error_401(self) -> None: + """Integration test for create_generic_connector error path (HTTP 401)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.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_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_generic_connector_error_403(self) -> None: + """Integration test for create_generic_connector error path (HTTP 403)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.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_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_generic_connector_error_404(self) -> None: + """Integration test for create_generic_connector error path (HTTP 404)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.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.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_generic_connector_error_500(self) -> None: + """Integration test for create_generic_connector error path (HTTP 500)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.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_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_generic_connector_happy_path(self) -> None: + """Integration test for delete_generic_connector success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response = self.api.delete_generic_connector_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_generic_connector_error_400(self) -> None: + """Integration test for delete_generic_connector error path (HTTP 400)""" + 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.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_generic_connector_error_401(self) -> None: + """Integration test for delete_generic_connector error path (HTTP 401)""" + 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.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_generic_connector_error_403(self) -> None: + """Integration test for delete_generic_connector error path (HTTP 403)""" + 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.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_generic_connector_error_404(self) -> None: + """Integration test for delete_generic_connector error path (HTTP 404)""" + 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.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_generic_connector_error_500(self) -> None: + """Integration test for delete_generic_connector error path (HTTP 500)""" + 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.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_generic_connector_happy_path(self) -> None: + """Integration test for get_generic_connector success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response_body_json = """ + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_generic_connector_error_400(self) -> None: + """Integration test for get_generic_connector error path (HTTP 400)""" + 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_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connector_error_401(self) -> None: + """Integration test for get_generic_connector error path (HTTP 401)""" + 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_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connector_error_403(self) -> None: + """Integration test for get_generic_connector error path (HTTP 403)""" + 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_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connector_error_404(self) -> None: + """Integration test for get_generic_connector error path (HTTP 404)""" + 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_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connector_error_500(self) -> None: + """Integration test for get_generic_connector error path (HTTP 500)""" + 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_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_generic_connectors_happy_path(self) -> None: + """Integration test for get_generic_connectors 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" + } + }, + "items" : [ { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + }, { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_generic_connectors_error_400(self) -> None: + """Integration test for get_generic_connectors 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_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connectors_error_401(self) -> None: + """Integration test for get_generic_connectors 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_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connectors_error_403(self) -> None: + """Integration test for get_generic_connectors 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_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connectors_error_404(self) -> None: + """Integration test for get_generic_connectors 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_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_generic_connectors_error_500(self) -> None: + """Integration test for get_generic_connectors 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_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_list_generic_connector_operations_happy_path(self) -> None: + """Integration test for list_generic_connector_operations success path""" + 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.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_list_generic_connector_operations_error_400(self) -> None: + """Integration test for list_generic_connector_operations error path (HTTP 400)""" + 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.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_list_generic_connector_operations_error_401(self) -> None: + """Integration test for list_generic_connector_operations error path (HTTP 401)""" + 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.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_list_generic_connector_operations_error_403(self) -> None: + """Integration test for list_generic_connector_operations error path (HTTP 403)""" + 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.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_list_generic_connector_operations_error_404(self) -> None: + """Integration test for list_generic_connector_operations error path (HTTP 404)""" + 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.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_list_generic_connector_operations_error_500(self) -> None: + """Integration test for list_generic_connector_operations error path (HTTP 500)""" + 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.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_generic_connector_happy_path(self) -> None: + """Integration test for update_generic_connector success path""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response_body_json = """ + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_generic_connector_error_400(self) -> None: + """Integration test for update_generic_connector error path (HTTP 400)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + 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.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_generic_connector_error_401(self) -> None: + """Integration test for update_generic_connector error path (HTTP 401)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + 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.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_generic_connector_error_403(self) -> None: + """Integration test for update_generic_connector error path (HTTP 403)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + 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.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_generic_connector_error_404(self) -> None: + """Integration test for update_generic_connector error path (HTTP 404)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + 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.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_generic_connector_error_500(self) -> None: + """Integration test for update_generic_connector error path (HTTP 500)""" + request_body_json = """ + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """ + generic_connector = thousandeyes_sdk.connectors.models.GenericConnector.from_json(request_body_json) + 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.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py new file mode 100644 index 00000000..2ab44d8a --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py new file mode 100644 index 00000000..e2be8479 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py @@ -0,0 +1,1344 @@ +# 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.webhook_operations_api import WebhookOperationsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebhookOperationsApiIntegration(IntegrationTestBase): + """WebhookOperationsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebhookOperationsApi(self.api_client) + + + def test_create_webhook_operation_happy_path(self) -> None: + """Integration test for create_webhook_operation success path""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", + "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_webhook_operation_error_400(self) -> None: + """Integration test for create_webhook_operation error path (HTTP 400)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.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_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_webhook_operation_error_401(self) -> None: + """Integration test for create_webhook_operation error path (HTTP 401)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.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_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_webhook_operation_error_403(self) -> None: + """Integration test for create_webhook_operation error path (HTTP 403)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.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_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_webhook_operation_error_404(self) -> None: + """Integration test for create_webhook_operation error path (HTTP 404)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.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.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_webhook_operation_error_500(self) -> None: + """Integration test for create_webhook_operation error path (HTTP 500)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.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_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_webhook_operation_happy_path(self) -> None: + """Integration test for delete_webhook_operation success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response = self.api.delete_webhook_operation_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_webhook_operation_error_400(self) -> None: + """Integration test for delete_webhook_operation error path (HTTP 400)""" + 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.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_webhook_operation_error_401(self) -> None: + """Integration test for delete_webhook_operation error path (HTTP 401)""" + 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.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_webhook_operation_error_403(self) -> None: + """Integration test for delete_webhook_operation error path (HTTP 403)""" + 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.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_webhook_operation_error_404(self) -> None: + """Integration test for delete_webhook_operation error path (HTTP 404)""" + 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.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_webhook_operation_error_500(self) -> None: + """Integration test for delete_webhook_operation error path (HTTP 500)""" + 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.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_webhook_operation_happy_path(self) -> None: + """Integration test for get_webhook_operation success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response_body_json = """ + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", + "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_webhook_operation_error_400(self) -> None: + """Integration test for get_webhook_operation error path (HTTP 400)""" + 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_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operation_error_401(self) -> None: + """Integration test for get_webhook_operation error path (HTTP 401)""" + 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_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operation_error_403(self) -> None: + """Integration test for get_webhook_operation error path (HTTP 403)""" + 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_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operation_error_404(self) -> None: + """Integration test for get_webhook_operation error path (HTTP 404)""" + 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_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operation_error_500(self) -> None: + """Integration test for get_webhook_operation error path (HTTP 500)""" + 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_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_webhook_operations_happy_path(self) -> None: + """Integration test for get_webhook_operations 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" + } + }, + "items" : [ { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", + "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + }, { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", + "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_webhook_operations_error_400(self) -> None: + """Integration test for get_webhook_operations 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_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operations_error_401(self) -> None: + """Integration test for get_webhook_operations 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_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operations_error_403(self) -> None: + """Integration test for get_webhook_operations 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_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operations_error_404(self) -> None: + """Integration test for get_webhook_operations 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_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_webhook_operations_error_500(self) -> None: + """Integration test for get_webhook_operations 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_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_webhook_operation_happy_path(self) -> None: + """Integration test for update_webhook_operation success path""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response_body_json = """ + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", + "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_webhook_operation_error_400(self) -> None: + """Integration test for update_webhook_operation error path (HTTP 400)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + 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.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_webhook_operation_error_401(self) -> None: + """Integration test for update_webhook_operation error path (HTTP 401)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + 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.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_webhook_operation_error_403(self) -> None: + """Integration test for update_webhook_operation error path (HTTP 403)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + 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.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_webhook_operation_error_404(self) -> None: + """Integration test for update_webhook_operation error path (HTTP 404)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + 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.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_webhook_operation_error_500(self) -> None: + """Integration test for update_webhook_operation error path (HTTP 500)""" + request_body_json = """ + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """ + webhook_operation = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json) + 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.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-credentials/test/conftest.py b/thousandeyes-sdk-credentials/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-credentials/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-credentials/test/integration_test_utils.py b/thousandeyes-sdk-credentials/test/integration_test_utils.py new file mode 100644 index 00000000..68f51d3e --- /dev/null +++ b/thousandeyes-sdk-credentials/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-credentials/test/mock_manifest.py b/thousandeyes-sdk-credentials/test/mock_manifest.py new file mode 100644 index 00000000..60292339 --- /dev/null +++ b/thousandeyes-sdk-credentials/test/mock_manifest.py @@ -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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py b/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py new file mode 100644 index 00000000..a3a421dd --- /dev/null +++ b/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py @@ -0,0 +1,1040 @@ +# 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 +import unittest +import thousandeyes_sdk.credentials.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.credentials.api.credentials_api import CredentialsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestCredentialsApiIntegration(IntegrationTestBase): + """CredentialsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = CredentialsApi(self.api_client) + + + def test_create_credential_happy_path(self) -> None: + """Integration test for create_credential success path""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + 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" + } + }, + "name" : "Example Credential", + "id" : "3247" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_credential_error_400(self) -> None: + """Integration test for create_credential error path (HTTP 400)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.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_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_error_401(self) -> None: + """Integration test for create_credential error path (HTTP 401)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.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_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_error_403(self) -> None: + """Integration test for create_credential error path (HTTP 403)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.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_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_error_404(self) -> None: + """Integration test for create_credential error path (HTTP 404)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.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_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_error_429(self) -> None: + """Integration test for create_credential error path (HTTP 429)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.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_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_credential_error_500(self) -> None: + """Integration test for create_credential error path (HTTP 500)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.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_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_credential_happy_path(self) -> None: + """Integration test for delete_credential success path""" + id = '3247' + aid = '1234' + response = self.api.delete_credential_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_credential_error_401(self) -> None: + """Integration test for delete_credential error path (HTTP 401)""" + id = '3247' + 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.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_error_403(self) -> None: + """Integration test for delete_credential error path (HTTP 403)""" + id = '3247' + 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.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_error_404(self) -> None: + """Integration test for delete_credential error path (HTTP 404)""" + id = '3247' + 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.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_error_429(self) -> None: + """Integration test for delete_credential error path (HTTP 429)""" + id = '3247' + 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.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_credential_error_500(self) -> None: + """Integration test for delete_credential error path (HTTP 500)""" + id = '3247' + 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.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_credential_happy_path(self) -> None: + """Integration test for get_credential success path""" + id = '3247' + 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" + } + }, + "name" : "Example Credential", + "id" : "3247", + "value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_credential_error_400(self) -> None: + """Integration test for get_credential error path (HTTP 400)""" + id = '3247' + 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_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_error_401(self) -> None: + """Integration test for get_credential error path (HTTP 401)""" + id = '3247' + 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_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_error_403(self) -> None: + """Integration test for get_credential error path (HTTP 403)""" + id = '3247' + 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_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_error_404(self) -> None: + """Integration test for get_credential error path (HTTP 404)""" + id = '3247' + 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_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_error_429(self) -> None: + """Integration test for get_credential error path (HTTP 429)""" + id = '3247' + 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_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credential_error_500(self) -> None: + """Integration test for get_credential error path (HTTP 500)""" + id = '3247' + 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_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_credentials_happy_path(self) -> None: + """Integration test for get_credentials success path""" + aid = '1234' + response_body_json = """ + { + "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" + } + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_credentials( + aid=aid, + _headers=self.te_headers("get_credentials"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_credentials_error_401(self) -> None: + """Integration test for get_credentials 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_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credentials_error_403(self) -> None: + """Integration test for get_credentials 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_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credentials_error_404(self) -> None: + """Integration test for get_credentials 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_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credentials_error_429(self) -> None: + """Integration test for get_credentials 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_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_credentials_error_500(self) -> None: + """Integration test for get_credentials 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_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_credential_happy_path(self) -> None: + """Integration test for update_credential success path""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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" + } + }, + "name" : "Example Credential", + "id" : "3247" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_credential_error_400(self) -> None: + """Integration test for update_credential error path (HTTP 400)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_error_401(self) -> None: + """Integration test for update_credential error path (HTTP 401)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_error_403(self) -> None: + """Integration test for update_credential error path (HTTP 403)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_error_404(self) -> None: + """Integration test for update_credential error path (HTTP 404)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_error_429(self) -> None: + """Integration test for update_credential error path (HTTP 429)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_credential_error_500(self) -> None: + """Integration test for update_credential error path (HTTP 500)""" + request_body_json = """ + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """ + credential_request = thousandeyes_sdk.credentials.models.CredentialRequest.from_json(request_body_json) + id = '3247' + 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.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-dashboards/test/conftest.py b/thousandeyes-sdk-dashboards/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-dashboards/test/integration_test_utils.py b/thousandeyes-sdk-dashboards/test/integration_test_utils.py new file mode 100644 index 00000000..752c1c5d --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-dashboards/test/mock_manifest.py b/thousandeyes-sdk-dashboards/test/mock_manifest.py new file mode 100644 index 00000000..bf980ccd --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/mock_manifest.py @@ -0,0 +1,5061 @@ +# 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 json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_dashboard_snapshot": OperationExpectation( + operation_id="create_dashboard_snapshot", + method="POST", + path="/dashboard-snapshots", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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=json.loads(""" + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dashboard_snapshot": OperationExpectation( + operation_id="delete_dashboard_snapshot", + method="DELETE", + path="/dashboard-snapshots/{snapshotId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + }, + success_status=204, + success_body=None, + 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", + ), + + }, + ), + + "get_dashboard_snapshot": OperationExpectation( + operation_id="get_dashboard_snapshot", + method="GET", + path="/dashboard-snapshots/{snapshotId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + }, + success_status=200, + success_body=json.loads(""" + + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" + }, + "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" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } + + """), + + 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", + ), + + }, + ), + + "get_dashboard_snapshot_widget_data": OperationExpectation( + operation_id="get_dashboard_snapshot_widget_data", + method="GET", + path="/dashboard-snapshots/{snapshotId}/widgets/{widgetId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + "widgetId": 'unpmg', + }, + success_status=200, + success_body=json.loads(""" + + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "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" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_dashboard_snapshots": OperationExpectation( + operation_id="get_dashboard_snapshots", + method="GET", + path="/dashboard-snapshots", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "pages" : { + "key" : "" + }, + "_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" + } + }, + "dashboardSnapshots" : [ { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" + }, + "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" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + }, { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" + }, + "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" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } ] + } + + """), + + 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", + ), + + }, + ), + + "update_dashboard_snapshot_expiration_date": OperationExpectation( + operation_id="update_dashboard_snapshot_expiration_date", + method="PATCH", + path="/dashboard-snapshots/{snapshotId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """), + 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", + ), + + }, + ), + + "create_dashboard": OperationExpectation( + operation_id="create_dashboard", + method="POST", + path="/dashboards", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + 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", + ), + + }, + ), + + "delete_dashboard": OperationExpectation( + operation_id="delete_dashboard", + method="DELETE", + path="/dashboards/{dashboardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + }, + success_status=204, + success_body=None, + 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", + ), + + }, + ), + + "get_dashboard": OperationExpectation( + operation_id="get_dashboard", + method="GET", + path="/dashboards/{dashboardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + }, + success_status=200, + success_body=json.loads(""" + + { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } + + """), + + 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", + ), + + }, + ), + + "get_dashboard_widget_data": OperationExpectation( + operation_id="get_dashboard_widget_data", + method="GET", + path="/dashboards/{dashboardId}/widgets/{widgetId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + "widgetId": 'unpmg', + }, + success_status=200, + success_body=json.loads(""" + + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "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" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_dashboards": OperationExpectation( + operation_id="get_dashboards", + method="GET", + path="/dashboards", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + [ { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } ] + + """), + + 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", + ), + + }, + ), + + "get_individual_card_data": OperationExpectation( + operation_id="get_individual_card_data", + method="GET", + path="/dashboards/{dashboardId}/widgets/{widgetId}/cards/{cardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + "widgetId": 'unpmg', + "cardId": 'rvwgs', + }, + success_status=200, + success_body=json.loads(""" + + { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } + + """), + + 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", + ), + + }, + ), + + "get_individual_column_data": OperationExpectation( + operation_id="get_individual_column_data", + method="GET", + path="/dashboards/{dashboardId}/widgets/{widgetId}/columns/{columnId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + "widgetId": 'unpmg', + "columnId": 'col123', + }, + 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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } + + """), + + 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", + ), + + }, + ), + + "update_dashboard": OperationExpectation( + operation_id="update_dashboard", + method="PUT", + path="/dashboards/{dashboardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + }, + success_status=200, + success_body=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + 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", + ), + + }, + ), + + "create_dashboard_filter": OperationExpectation( + operation_id="create_dashboard_filter", + method="POST", + path="/dashboards/filters", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """), + 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", + ), + + }, + ), + + "delete_dashboard_filter": OperationExpectation( + operation_id="delete_dashboard_filter", + method="DELETE", + path="/dashboards/filters/{id}", + path_param_examples={ + "id": '65bc18e8f2073a4a469cd958', + }, + success_status=204, + success_body=None, + 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", + ), + + }, + ), + + "get_dashboard_filter": OperationExpectation( + operation_id="get_dashboard_filter", + method="GET", + path="/dashboards/filters/{id}", + path_param_examples={ + "id": '65bc18e8f2073a4a469cd958', + }, + success_status=200, + success_body=json.loads(""" + + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + + """), + + 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", + ), + + }, + ), + + "get_dashboards_filters": OperationExpectation( + operation_id="get_dashboards_filters", + method="GET", + path="/dashboards/filters", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "dashboardFilters" : [ { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + }, { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } ] + } + + """), + + 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", + ), + + }, + ), + + "update_dashboard_filter": OperationExpectation( + operation_id="update_dashboard_filter", + method="PUT", + path="/dashboards/filters/{id}", + path_param_examples={ + "id": '65bc18e8f2073a4a469cd958', + }, + success_status=200, + success_body=json.loads(""" + + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """), + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py new file mode 100644 index 00000000..0f1393de --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py @@ -0,0 +1,2466 @@ +# 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 json +import unittest +import thousandeyes_sdk.dashboards.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.dashboards.api.dashboard_snapshots_api import DashboardSnapshotsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): + """DashboardSnapshotsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DashboardSnapshotsApi(self.api_client) + + + def test_create_dashboard_snapshot_happy_path(self) -> None: + """Integration test for create_dashboard_snapshot success path""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dashboard_snapshot_error_400(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 400)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.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_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_401(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 401)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.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_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_403(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 403)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.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_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_404(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 404)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.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.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_500(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 500)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.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_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dashboard_snapshot_happy_path(self) -> None: + """Integration test for delete_dashboard_snapshot success path""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + response = self.api.delete_dashboard_snapshot_with_http_info( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dashboard_snapshot_error_400(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 400)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_401(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 401)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_403(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 403)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_404(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 404)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_429(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 429)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_500(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 500)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_snapshot_happy_path(self) -> None: + """Integration test for get_dashboard_snapshot success path""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + response_body_json = """ + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" + }, + "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" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_snapshot_error_400(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 400)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_401(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 401)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_403(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 403)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_404(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 404)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_429(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 429)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_500(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 500)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_snapshot_widget_data_happy_path(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data success path""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + response_body_json = """ + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "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" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_snapshot_widget_data_error_400(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 400)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + 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_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_401(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 401)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + 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_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_403(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 403)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + 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_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_404(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 404)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + 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_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_429(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 429)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + 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_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_500(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 500)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + 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_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_snapshots_happy_path(self) -> None: + """Integration test for get_dashboard_snapshots success path""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + response_body_json = """ + { + "pages" : { + "key" : "" + }, + "_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" + } + }, + "dashboardSnapshots" : [ { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" + }, + "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" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + }, { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" + }, + "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" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_snapshots_error_400(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 400)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_401(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 401)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_403(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 403)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_404(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 404)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_429(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 429)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_500(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 500)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dashboard_snapshot_expiration_date_happy_path(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date success path""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + response = self.api.update_dashboard_snapshot_expiration_date_with_http_info( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_update_dashboard_snapshot_expiration_date_error_400(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 400)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_401(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 401)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_403(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 403)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_404(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 404)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_429(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 429)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_500(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 500)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + 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.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py new file mode 100644 index 00000000..56e850a2 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py @@ -0,0 +1,4825 @@ +# 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 json +import unittest +import thousandeyes_sdk.dashboards.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.dashboards.api.dashboards_api import DashboardsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDashboardsApiIntegration(IntegrationTestBase): + """DashboardsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DashboardsApi(self.api_client) + + + def test_create_dashboard_happy_path(self) -> None: + """Integration test for create_dashboard success path""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dashboard_error_400(self) -> None: + """Integration test for create_dashboard error path (HTTP 400)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.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_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_401(self) -> None: + """Integration test for create_dashboard error path (HTTP 401)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.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_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_403(self) -> None: + """Integration test for create_dashboard error path (HTTP 403)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.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_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_404(self) -> None: + """Integration test for create_dashboard error path (HTTP 404)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.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.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_429(self) -> None: + """Integration test for create_dashboard error path (HTTP 429)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.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_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_500(self) -> None: + """Integration test for create_dashboard error path (HTTP 500)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.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_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dashboard_happy_path(self) -> None: + """Integration test for delete_dashboard success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + response = self.api.delete_dashboard_with_http_info( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dashboard_error_400(self) -> None: + """Integration test for delete_dashboard error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_401(self) -> None: + """Integration test for delete_dashboard error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_403(self) -> None: + """Integration test for delete_dashboard error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_404(self) -> None: + """Integration test for delete_dashboard error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_429(self) -> None: + """Integration test for delete_dashboard error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_500(self) -> None: + """Integration test for delete_dashboard error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_happy_path(self) -> None: + """Integration test for get_dashboard success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + response_body_json = """ + { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_error_400(self) -> None: + """Integration test for get_dashboard error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_401(self) -> None: + """Integration test for get_dashboard error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_403(self) -> None: + """Integration test for get_dashboard error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_404(self) -> None: + """Integration test for get_dashboard error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_429(self) -> None: + """Integration test for get_dashboard error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_500(self) -> None: + """Integration test for get_dashboard error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_widget_data_happy_path(self) -> None: + """Integration test for get_dashboard_widget_data success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + response_body_json = """ + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "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" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_widget_data_error_400(self) -> None: + """Integration test for get_dashboard_widget_data error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + 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_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_widget_data_error_401(self) -> None: + """Integration test for get_dashboard_widget_data error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + 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_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_widget_data_error_403(self) -> None: + """Integration test for get_dashboard_widget_data error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + 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_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_widget_data_error_404(self) -> None: + """Integration test for get_dashboard_widget_data error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + 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_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_widget_data_error_429(self) -> None: + """Integration test for get_dashboard_widget_data error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + 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_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_widget_data_error_500(self) -> None: + """Integration test for get_dashboard_widget_data error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + order = thousandeyes_sdk.dashboards.DashboardOrder() + 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_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, + order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboards_happy_path(self) -> None: + """Integration test for get_dashboards success path""" + aid = '1234' + response_body_json = """ + [ { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } ] + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboards_error_400(self) -> None: + """Integration test for get_dashboards 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_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_error_401(self) -> None: + """Integration test for get_dashboards 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_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_error_403(self) -> None: + """Integration test for get_dashboards 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_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_error_404(self) -> None: + """Integration test for get_dashboards 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_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_error_429(self) -> None: + """Integration test for get_dashboards 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_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_error_500(self) -> None: + """Integration test for get_dashboards 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_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_individual_card_data_happy_path(self) -> None: + """Integration test for get_individual_card_data success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + response_body_json = """ + { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_individual_card_data_error_400(self) -> None: + """Integration test for get_individual_card_data error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + 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_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_card_data_error_401(self) -> None: + """Integration test for get_individual_card_data error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + 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_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_card_data_error_403(self) -> None: + """Integration test for get_individual_card_data error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_card_data_error_404(self) -> None: + """Integration test for get_individual_card_data error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_card_data_error_429(self) -> None: + """Integration test for get_individual_card_data error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_card_data_error_500(self) -> None: + """Integration test for get_individual_card_data error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + card_id = 'rvwgs' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_individual_column_data_happy_path(self) -> None: + """Integration test for get_individual_column_data success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + 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" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_individual_column_data_error_400(self) -> None: + """Integration test for get_individual_column_data error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + 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_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_column_data_error_401(self) -> None: + """Integration test for get_individual_column_data error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + 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_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_column_data_error_403(self) -> None: + """Integration test for get_individual_column_data error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_column_data_error_404(self) -> None: + """Integration test for get_individual_column_data error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_column_data_error_429(self) -> None: + """Integration test for get_individual_column_data error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_individual_column_data_error_500(self) -> None: + """Integration test for get_individual_column_data error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + column_id = 'col123' + 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" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dashboard_happy_path(self) -> None: + """Integration test for update_dashboard success path""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + response_body_json = """ + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_dashboard_error_400(self) -> None: + """Integration test for update_dashboard error path (HTTP 400)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_401(self) -> None: + """Integration test for update_dashboard error path (HTTP 401)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_403(self) -> None: + """Integration test for update_dashboard error path (HTTP 403)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_404(self) -> None: + """Integration test for update_dashboard error path (HTTP 404)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_429(self) -> None: + """Integration test for update_dashboard error path (HTTP 429)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_500(self) -> None: + """Integration test for update_dashboard error path (HTTP 500)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + 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.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py new file mode 100644 index 00000000..e50a0a17 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py @@ -0,0 +1,1602 @@ +# 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 json +import unittest +import thousandeyes_sdk.dashboards.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.dashboards.api.dashboards_filters_api import DashboardsFiltersApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDashboardsFiltersApiIntegration(IntegrationTestBase): + """DashboardsFiltersApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DashboardsFiltersApi(self.api_client) + + + def test_create_dashboard_filter_happy_path(self) -> None: + """Integration test for create_dashboard_filter success path""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dashboard_filter_error_400(self) -> None: + """Integration test for create_dashboard_filter error path (HTTP 400)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.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_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_filter_error_401(self) -> None: + """Integration test for create_dashboard_filter error path (HTTP 401)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.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_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_filter_error_403(self) -> None: + """Integration test for create_dashboard_filter error path (HTTP 403)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.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_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_filter_error_404(self) -> None: + """Integration test for create_dashboard_filter error path (HTTP 404)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.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.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_filter_error_429(self) -> None: + """Integration test for create_dashboard_filter error path (HTTP 429)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.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_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_filter_error_500(self) -> None: + """Integration test for create_dashboard_filter error path (HTTP 500)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.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_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dashboard_filter_happy_path(self) -> None: + """Integration test for delete_dashboard_filter success path""" + id = '65bc18e8f2073a4a469cd958' + aid = '1234' + response = self.api.delete_dashboard_filter_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dashboard_filter_error_400(self) -> None: + """Integration test for delete_dashboard_filter error path (HTTP 400)""" + id = '65bc18e8f2073a4a469cd958' + 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.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_filter_error_401(self) -> None: + """Integration test for delete_dashboard_filter error path (HTTP 401)""" + id = '65bc18e8f2073a4a469cd958' + 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.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_filter_error_403(self) -> None: + """Integration test for delete_dashboard_filter error path (HTTP 403)""" + id = '65bc18e8f2073a4a469cd958' + 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.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_filter_error_404(self) -> None: + """Integration test for delete_dashboard_filter error path (HTTP 404)""" + id = '65bc18e8f2073a4a469cd958' + 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.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_filter_error_429(self) -> None: + """Integration test for delete_dashboard_filter error path (HTTP 429)""" + id = '65bc18e8f2073a4a469cd958' + 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.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_filter_error_500(self) -> None: + """Integration test for delete_dashboard_filter error path (HTTP 500)""" + id = '65bc18e8f2073a4a469cd958' + 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.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_filter_happy_path(self) -> None: + """Integration test for get_dashboard_filter success path""" + id = '65bc18e8f2073a4a469cd958' + aid = '1234' + response_body_json = """ + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_filter_error_400(self) -> None: + """Integration test for get_dashboard_filter error path (HTTP 400)""" + id = '65bc18e8f2073a4a469cd958' + 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_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_filter_error_401(self) -> None: + """Integration test for get_dashboard_filter error path (HTTP 401)""" + id = '65bc18e8f2073a4a469cd958' + 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_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_filter_error_403(self) -> None: + """Integration test for get_dashboard_filter error path (HTTP 403)""" + id = '65bc18e8f2073a4a469cd958' + 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_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_filter_error_404(self) -> None: + """Integration test for get_dashboard_filter error path (HTTP 404)""" + id = '65bc18e8f2073a4a469cd958' + 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_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_filter_error_429(self) -> None: + """Integration test for get_dashboard_filter error path (HTTP 429)""" + id = '65bc18e8f2073a4a469cd958' + 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_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_filter_error_500(self) -> None: + """Integration test for get_dashboard_filter error path (HTTP 500)""" + id = '65bc18e8f2073a4a469cd958' + 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_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboards_filters_happy_path(self) -> None: + """Integration test for get_dashboards_filters success path""" + search_pattern = 'cea-filter' + aid = '1234' + response_body_json = """ + { + "dashboardFilters" : [ { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + }, { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboards_filters_error_400(self) -> None: + """Integration test for get_dashboards_filters error path (HTTP 400)""" + search_pattern = 'cea-filter' + 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_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_filters_error_401(self) -> None: + """Integration test for get_dashboards_filters error path (HTTP 401)""" + search_pattern = 'cea-filter' + 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_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_filters_error_403(self) -> None: + """Integration test for get_dashboards_filters error path (HTTP 403)""" + search_pattern = 'cea-filter' + 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_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_filters_error_404(self) -> None: + """Integration test for get_dashboards_filters error path (HTTP 404)""" + search_pattern = 'cea-filter' + 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_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_filters_error_429(self) -> None: + """Integration test for get_dashboards_filters error path (HTTP 429)""" + search_pattern = 'cea-filter' + 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_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboards_filters_error_500(self) -> None: + """Integration test for get_dashboards_filters error path (HTTP 500)""" + search_pattern = 'cea-filter' + 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_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dashboard_filter_happy_path(self) -> None: + """Integration test for update_dashboard_filter success path""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + aid = '1234' + response_body_json = """ + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_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" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_dashboard_filter_error_400(self) -> None: + """Integration test for update_dashboard_filter error path (HTTP 400)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + 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.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_filter_error_401(self) -> None: + """Integration test for update_dashboard_filter error path (HTTP 401)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + 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.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_filter_error_403(self) -> None: + """Integration test for update_dashboard_filter error path (HTTP 403)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + 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.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_filter_error_404(self) -> None: + """Integration test for update_dashboard_filter error path (HTTP 404)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + 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.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_filter_error_429(self) -> None: + """Integration test for update_dashboard_filter error path (HTTP 429)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + 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.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_filter_error_500(self) -> None: + """Integration test for update_dashboard_filter error path (HTTP 500)""" + request_body_json = """ + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """ + api_context_filter_request = thousandeyes_sdk.dashboards.models.ApiContextFilterRequest.from_json(request_body_json) + id = '65bc18e8f2073a4a469cd958' + 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.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-emulation/test/conftest.py b/thousandeyes-sdk-emulation/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-emulation/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-emulation/test/integration_test_utils.py b/thousandeyes-sdk-emulation/test/integration_test_utils.py new file mode 100644 index 00000000..4b2b0465 --- /dev/null +++ b/thousandeyes-sdk-emulation/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-emulation/test/mock_manifest.py b/thousandeyes-sdk-emulation/test/mock_manifest.py new file mode 100644 index 00000000..395e0ebb --- /dev/null +++ b/thousandeyes-sdk-emulation/test/mock_manifest.py @@ -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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py b/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py new file mode 100644 index 00000000..7aca00ab --- /dev/null +++ b/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-agents/test/conftest.py b/thousandeyes-sdk-endpoint-agents/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py new file mode 100644 index 00000000..494f9642 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py b/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py new file mode 100644 index 00000000..6ddba81c --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py @@ -0,0 +1,2514 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_endpoint_agent_log_items": OperationExpectation( + operation_id="get_endpoint_agent_log_items", + method="GET", + path="/endpoint/agents/{agentId}/logs", + path_param_examples={ + "agentId": 'agent_id_example', + }, + 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" + } + }, + "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 + } ] + } + + """), + + 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", + ), + + "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", + ), + + }, + ), + + "delete_endpoint_agent": OperationExpectation( + operation_id="delete_endpoint_agent", + method="DELETE", + path="/endpoint/agents/{agentId}", + path_param_examples={ + "agentId": 'agent_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" : 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", + ), + + }, + ), + + "disable_endpoint_agent": OperationExpectation( + operation_id="disable_endpoint_agent", + method="POST", + path="/endpoint/agents/{agentId}/disable", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + 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", + ), + + }, + ), + + "enable_endpoint_agent": OperationExpectation( + operation_id="enable_endpoint_agent", + method="POST", + path="/endpoint/agents/{agentId}/enable", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + 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", + ), + + }, + ), + + "filter_endpoint_agents": OperationExpectation( + operation_id="filter_endpoint_agents", + method="POST", + path="/endpoint/agents/filter", + 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" + } + }, + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + }, { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + }, + ), + + "get_endpoint_agent": OperationExpectation( + operation_id="get_endpoint_agent", + method="GET", + path="/endpoint/agents/{agentId}", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_endpoint_agents": OperationExpectation( + operation_id="get_endpoint_agents", + method="GET", + path="/endpoint/agents", + 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" + } + }, + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + }, { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } ] + } + + """), + + 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", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_agents_connection_string": OperationExpectation( + operation_id="get_endpoint_agents_connection_string", + method="GET", + path="/endpoint/agents/connection-string", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "connectionString" : "D2xZSLlqo64Xe2EnYisklA==", + "_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" : 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", + ), + + }, + ), + + "update_endpoint_agent": OperationExpectation( + operation_id="update_endpoint_agent", + method="PATCH", + path="/endpoint/agents/{agentId}", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """), + 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", + ), + + }, + ), + + "transfer_endpoint_agents": OperationExpectation( + operation_id="transfer_endpoint_agents", + method="POST", + path="/endpoint/agents/transfer/bulk", + path_param_examples={ + }, + success_status=207, + success_body=json.loads(""" + + { + "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" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "transfers" : [ { + "agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba", + "fromAid" : "1234", + "toAid" : "12345" + }, { + "agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba", + "fromAid" : "1234", + "toAid" : "12345" + } ] + } + + """), + 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", + ), + + }, + ), + + "get_endpoint_proxies": OperationExpectation( + operation_id="get_endpoint_proxies", + method="GET", + path="/endpoint/proxies", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } ] + } + + """), + + 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", + ), + + "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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py new file mode 100644 index 00000000..e32711ce --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py new file mode 100644 index 00000000..b27db3da --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py @@ -0,0 +1,2767 @@ +# 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_api import EndpointAgentsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestEndpointAgentsApiIntegration(IntegrationTestBase): + """EndpointAgentsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = EndpointAgentsApi(self.api_client) + + + def test_delete_endpoint_agent_happy_path(self) -> None: + """Integration test for delete_endpoint_agent success path""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + response = self.api.delete_endpoint_agent_with_http_info( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("delete_endpoint_agent"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_endpoint_agent_error_401(self) -> None: + """Integration test for delete_endpoint_agent error path (HTTP 401)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_endpoint_agent_error_403(self) -> None: + """Integration test for delete_endpoint_agent error path (HTTP 403)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_endpoint_agent_error_404(self) -> None: + """Integration test for delete_endpoint_agent error path (HTTP 404)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_endpoint_agent_error_429(self) -> None: + """Integration test for delete_endpoint_agent error path (HTTP 429)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_disable_endpoint_agent_happy_path(self) -> None: + """Integration test for disable_endpoint_agent success path""" + agent_id = 'agent_id_example' + aid = '1234' + response_body_json = """ + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_disable_endpoint_agent_error_401(self) -> None: + """Integration test for disable_endpoint_agent error path (HTTP 401)""" + agent_id = 'agent_id_example' + 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.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_disable_endpoint_agent_error_403(self) -> None: + """Integration test for disable_endpoint_agent error path (HTTP 403)""" + agent_id = 'agent_id_example' + 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.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_disable_endpoint_agent_error_404(self) -> None: + """Integration test for disable_endpoint_agent error path (HTTP 404)""" + agent_id = 'agent_id_example' + 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.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_disable_endpoint_agent_error_429(self) -> None: + """Integration test for disable_endpoint_agent error path (HTTP 429)""" + agent_id = 'agent_id_example' + 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.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_enable_endpoint_agent_happy_path(self) -> None: + """Integration test for enable_endpoint_agent success path""" + agent_id = 'agent_id_example' + aid = '1234' + response_body_json = """ + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_enable_endpoint_agent_error_401(self) -> None: + """Integration test for enable_endpoint_agent error path (HTTP 401)""" + agent_id = 'agent_id_example' + 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.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_enable_endpoint_agent_error_403(self) -> None: + """Integration test for enable_endpoint_agent error path (HTTP 403)""" + agent_id = 'agent_id_example' + 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.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_enable_endpoint_agent_error_404(self) -> None: + """Integration test for enable_endpoint_agent error path (HTTP 404)""" + agent_id = 'agent_id_example' + 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.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_enable_endpoint_agent_error_429(self) -> None: + """Integration test for enable_endpoint_agent error path (HTTP 429)""" + agent_id = 'agent_id_example' + 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.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_filter_endpoint_agents_happy_path(self) -> None: + """Integration test for filter_endpoint_agents success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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" + } + }, + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + }, { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_endpoint_agents_error_400(self) -> None: + """Integration test for filter_endpoint_agents error path (HTTP 400)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_endpoint_agents_error_401(self) -> None: + """Integration test for filter_endpoint_agents error path (HTTP 401)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_endpoint_agents_error_403(self) -> None: + """Integration test for filter_endpoint_agents error path (HTTP 403)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_endpoint_agents_error_429(self) -> None: + """Integration test for filter_endpoint_agents error path (HTTP 429)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_endpoint_agent_happy_path(self) -> None: + """Integration test for get_endpoint_agent success path""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + response_body_json = """ + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_endpoint_agent_error_401(self) -> None: + """Integration test for get_endpoint_agent error path (HTTP 401)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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( + agent_id=agent_id, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agent_error_403(self) -> None: + """Integration test for get_endpoint_agent error path (HTTP 403)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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( + agent_id=agent_id, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agent_error_404(self) -> None: + """Integration test for get_endpoint_agent error path (HTTP 404)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agent_error_429(self) -> None: + """Integration test for get_endpoint_agent error path (HTTP 429)""" + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + 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( + agent_id=agent_id, + aid=aid, + expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_endpoint_agents_happy_path(self) -> None: + """Integration test for get_endpoint_agents success path""" + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + use_all_permitted_aids = False + agent_name = 'agent_name_example' + computer_name = 'computer_name_example' + 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" + } + }, + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + }, { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_endpoint_agents_error_401(self) -> None: + """Integration test for get_endpoint_agents error path (HTTP 401)""" + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + use_all_permitted_aids = False + agent_name = 'agent_name_example' + computer_name = 'computer_name_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_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agents_error_403(self) -> None: + """Integration test for get_endpoint_agents error path (HTTP 403)""" + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + use_all_permitted_aids = False + agent_name = 'agent_name_example' + computer_name = 'computer_name_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_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agents_error_429(self) -> None: + """Integration test for get_endpoint_agents error path (HTTP 429)""" + max = 5 + cursor = 'cursor_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + include_deleted = false + use_all_permitted_aids = False + agent_name = 'agent_name_example' + computer_name = 'computer_name_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_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, + expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_endpoint_agents_connection_string_happy_path(self) -> None: + """Integration test for get_endpoint_agents_connection_string success path""" + aid = '1234' + response_body_json = """ + { + "connectionString" : "D2xZSLlqo64Xe2EnYisklA==", + "_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_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_endpoint_agents_connection_string_error_401(self) -> None: + """Integration test for get_endpoint_agents_connection_string 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_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agents_connection_string_error_403(self) -> None: + """Integration test for get_endpoint_agents_connection_string 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_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_agents_connection_string_error_429(self) -> None: + """Integration test for get_endpoint_agents_connection_string 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_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_endpoint_agent_happy_path(self) -> None: + """Integration test for update_endpoint_agent success path""" + request_body_json = """ + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """ + endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + response_body_json = """ + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_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" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_endpoint_agent_error_401(self) -> None: + """Integration test for update_endpoint_agent error path (HTTP 401)""" + request_body_json = """ + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """ + endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.update_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_agent_error_403(self) -> None: + """Integration test for update_endpoint_agent error path (HTTP 403)""" + request_body_json = """ + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """ + endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.update_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_agent_error_404(self) -> None: + """Integration test for update_endpoint_agent error path (HTTP 404)""" + request_body_json = """ + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """ + endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.update_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_agent_error_429(self) -> None: + """Integration test for update_endpoint_agent error path (HTTP 429)""" + request_body_json = """ + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """ + endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) + agent_id = 'agent_id_example' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] + 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.update_endpoint_agent( + agent_id=agent_id, + aid=aid, + expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py new file mode 100644 index 00000000..52a14b13 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py new file mode 100644 index 00000000..9c5b77a8 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/conftest.py b/thousandeyes-sdk-endpoint-instant-tests/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py new file mode 100644 index 00000000..fe6515fb --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py b/thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py new file mode 100644 index 00000000..dffd1438 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py @@ -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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py new file mode 100644 index 00000000..49a5b581 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py new file mode 100644 index 00000000..52acabf7 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py new file mode 100644 index 00000000..a227b665 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-labels/test/conftest.py b/thousandeyes-sdk-endpoint-labels/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py new file mode 100644 index 00000000..19d6418c --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-endpoint-labels/test/mock_manifest.py b/thousandeyes-sdk-endpoint-labels/test/mock_manifest.py new file mode 100644 index 00000000..0174c17a --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/mock_manifest.py @@ -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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py b/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py new file mode 100644 index 00000000..f2366c97 --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py @@ -0,0 +1,1026 @@ +# 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 +import unittest +import thousandeyes_sdk.endpoint_labels.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_labels.api.endpoint_agent_labels_api import EndpointAgentLabelsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): + """EndpointAgentLabelsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = EndpointAgentLabelsApi(self.api_client) + + + def test_create_endpoint_label_happy_path(self) -> None: + """Integration test for create_endpoint_label success path""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label_request = thousandeyes_sdk.endpoint_labels.models.LabelRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "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" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_endpoint_label_error_400(self) -> None: + """Integration test for create_endpoint_label error path (HTTP 400)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label_request = thousandeyes_sdk.endpoint_labels.models.LabelRequest.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_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_endpoint_label_error_401(self) -> None: + """Integration test for create_endpoint_label error path (HTTP 401)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label_request = thousandeyes_sdk.endpoint_labels.models.LabelRequest.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_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_endpoint_label_error_403(self) -> None: + """Integration test for create_endpoint_label error path (HTTP 403)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label_request = thousandeyes_sdk.endpoint_labels.models.LabelRequest.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_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_endpoint_label_error_429(self) -> None: + """Integration test for create_endpoint_label error path (HTTP 429)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label_request = thousandeyes_sdk.endpoint_labels.models.LabelRequest.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_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_endpoint_label_happy_path(self) -> None: + """Integration test for delete_endpoint_label success path""" + id = 'id_example' + aid = '1234' + response = self.api.delete_endpoint_label_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_endpoint_label_error_401(self) -> None: + """Integration test for delete_endpoint_label error path (HTTP 401)""" + id = 'id_example' + 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.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_endpoint_label_error_403(self) -> None: + """Integration test for delete_endpoint_label error path (HTTP 403)""" + id = 'id_example' + 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.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_endpoint_label_error_404(self) -> None: + """Integration test for delete_endpoint_label error path (HTTP 404)""" + id = 'id_example' + 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.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_endpoint_label_error_429(self) -> None: + """Integration test for delete_endpoint_label error path (HTTP 429)""" + id = 'id_example' + 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.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_endpoint_label_happy_path(self) -> None: + """Integration test for get_endpoint_label success path""" + id = 'id_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + aid = '1234' + response_body_json = """ + { + "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" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_endpoint_label( + id=id, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_endpoint_label_error_401(self) -> None: + """Integration test for get_endpoint_label error path (HTTP 401)""" + id = 'id_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_label( + id=id, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_label_error_403(self) -> None: + """Integration test for get_endpoint_label error path (HTTP 403)""" + id = 'id_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_label( + id=id, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_label_error_404(self) -> None: + """Integration test for get_endpoint_label error path (HTTP 404)""" + id = 'id_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_endpoint_label( + id=id, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_label_error_429(self) -> None: + """Integration test for get_endpoint_label error path (HTTP 429)""" + id = 'id_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_label( + id=id, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_endpoint_labels_happy_path(self) -> None: + """Integration test for get_endpoint_labels success path""" + max = 5 + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + aid = '1234' + 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" + } + }, + "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" + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_endpoint_labels( + max=max, + cursor=cursor, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_endpoint_labels_error_401(self) -> None: + """Integration test for get_endpoint_labels error path (HTTP 401)""" + max = 5 + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_labels( + max=max, + cursor=cursor, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_labels_error_403(self) -> None: + """Integration test for get_endpoint_labels error path (HTTP 403)""" + max = 5 + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_labels( + max=max, + cursor=cursor, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_endpoint_labels_error_429(self) -> None: + """Integration test for get_endpoint_labels error path (HTTP 429)""" + max = 5 + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] + 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_labels( + max=max, + cursor=cursor, + expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_endpoint_label_happy_path(self) -> None: + """Integration test for update_endpoint_label success path""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label = thousandeyes_sdk.endpoint_labels.models.Label.from_json(request_body_json) + id = 'id_example' + aid = '1234' + response_body_json = """ + { + "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" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_endpoint_label_error_400(self) -> None: + """Integration test for update_endpoint_label error path (HTTP 400)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label = thousandeyes_sdk.endpoint_labels.models.Label.from_json(request_body_json) + id = 'id_example' + 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.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_label_error_401(self) -> None: + """Integration test for update_endpoint_label error path (HTTP 401)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label = thousandeyes_sdk.endpoint_labels.models.Label.from_json(request_body_json) + id = 'id_example' + 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.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_label_error_403(self) -> None: + """Integration test for update_endpoint_label error path (HTTP 403)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label = thousandeyes_sdk.endpoint_labels.models.Label.from_json(request_body_json) + id = 'id_example' + 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.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_label_error_404(self) -> None: + """Integration test for update_endpoint_label error path (HTTP 404)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label = thousandeyes_sdk.endpoint_labels.models.Label.from_json(request_body_json) + id = 'id_example' + 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.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_endpoint_label_error_429(self) -> None: + """Integration test for update_endpoint_label error path (HTTP 429)""" + request_body_json = """ + + { + "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" + } ] + } + + """ + label = thousandeyes_sdk.endpoint_labels.models.Label.from_json(request_body_json) + id = 'id_example' + 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.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-test-results/test/conftest.py b/thousandeyes-sdk-endpoint-test-results/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py new file mode 100644 index 00000000..5565044a --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py b/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py new file mode 100644 index 00000000..e8e13b7f --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py @@ -0,0 +1,7512 @@ +# 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 json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_http_server_scheduled_test_results": OperationExpectation( + operation_id="get_http_server_scheduled_test_results", + method="GET", + path="/endpoint/test-results/scheduled-tests/{testId}/http-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "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" + }, + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_multi_test_filtered_http_server_scheduled_test_results": OperationExpectation( + operation_id="get_multi_test_filtered_http_server_scheduled_test_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/http-server/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_single_test_filtered_http_server_scheduled_test_results": OperationExpectation( + operation_id="get_single_test_filtered_http_server_scheduled_test_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/{testId}/http-server/filter", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_local_networks_test_results_topologies": OperationExpectation( + operation_id="filter_local_networks_test_results_topologies", + method="POST", + path="/endpoint/test-results/local-networks/topologies/filter", + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + } + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + } + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_local_networks_test_results": OperationExpectation( + operation_id="get_local_networks_test_results", + method="GET", + path="/endpoint/test-results/local-networks", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "localNetworks" : [ { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" + }, { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_local_networks_test_results_topology": OperationExpectation( + operation_id="get_local_networks_test_results_topology", + method="GET", + path="/endpoint/test-results/local-networks/topologies/{networkTopologyId}", + path_param_examples={ + "networkTopologyId": '00160:39c518560de9:1491651900:236e6f18', + }, + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + } ], + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + } ], + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_dynamic_test_network_results": OperationExpectation( + operation_id="filter_dynamic_test_network_results", + method="POST", + path="/endpoint/test-results/dynamic-tests/{testId}/network/filter", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + }, + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dynamic_test_path_vis_agent_round_results": OperationExpectation( + operation_id="get_dynamic_test_path_vis_agent_round_results", + method="GET", + path="/endpoint/test-results/dynamic-tests/{testId}/path-vis/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dynamic_test_path_vis_results": OperationExpectation( + operation_id="get_dynamic_test_path_vis_results", + method="GET", + path="/endpoint/test-results/dynamic-tests/{testId}/path-vis", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + }, + "endDate" : "2022-07-18T22:00:54Z", + "totalHits" : 12, + "_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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_scheduled_test_network_results": OperationExpectation( + operation_id="filter_scheduled_test_network_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/{testId}/network/filter", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "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" + }, + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_scheduled_tests_network_results": OperationExpectation( + operation_id="filter_scheduled_tests_network_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/network/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_scheduled_test_path_vis_agent_round_results": OperationExpectation( + operation_id="get_scheduled_test_path_vis_agent_round_results", + method="GET", + path="/endpoint/test-results/scheduled-tests/{testId}/path-vis/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_scheduled_test_path_vis_results": OperationExpectation( + operation_id="get_scheduled_test_path_vis_results", + method="GET", + path="/endpoint/test-results/scheduled-tests/{testId}/path-vis", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "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" + }, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_real_user_tests_network_results": OperationExpectation( + operation_id="filter_real_user_tests_network_results", + method="POST", + path="/endpoint/test-results/real-user-tests/networks/filter", + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_real_user_tests_results": OperationExpectation( + operation_id="filter_real_user_tests_results", + method="POST", + path="/endpoint/test-results/real-user-tests/filter", + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_real_user_tests_visited_pages_results": OperationExpectation( + operation_id="filter_real_user_tests_visited_pages_results", + method="POST", + path="/endpoint/test-results/real-user-tests/pages/filter", + 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" + } + }, + "results" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_real_user_test_page_results": OperationExpectation( + operation_id="get_real_user_test_page_results", + method="GET", + path="/endpoint/test-results/real-user-tests/{id}/pages/{pageId}", + path_param_examples={ + "id": '07625:1490529480:h3qJQTpl', + "pageId": '281474976710706', + }, + 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" + } + }, + "har" : { + "log" : { + "browser" : { + "name" : "Google Chrome", + "version" : "57.0.2987.98" + }, + "creator" : { + "name" : "ThousandEyes Endpoint Agent", + "version" : "0.47.0" + }, + "entries" : [ { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "Upgrade-Insecure-Requests", + "value" : "1" + }, { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + }, { + "name" : "Cookie", + "value" : "(removed)" + } ], + "method" : "GET", + "queryString" : [ { + "name" : "locale", + "value" : "en-US" + } ], + "url" : "https://www.thousandeyes.com/resources" + }, + "response" : { + "bodySize" : 17776, + "content" : { + "mimeType" : "text/html;charset=ISO-8859-1", + "size" : 17776 + }, + "headers" : [ { + "name" : "Content-Type", + "value" : "text/html;charset=ISO-8859-1" + }, { + "name" : "Content-Length", + "value" : "17776" + }, { + "name" : "Connection", + "value" : "keep-alive" + }, { + "name" : "Date", + "value" : "Sun, 26 Mar 2017 11:58:54 GMT" + }, { + "name" : "Server", + "value" : "Apache" + }, { + "name" : "Cache-Control", + "value" : "max-age=600, must-revalidate" + }, { + "name" : "Content-Language", + "value" : "en-US" + }, { + "name" : "Content-Encoding", + "value" : "gzip" + }, { + "name" : "X-Frame-Options", + "value" : "sameorigin" + }, { + "name" : "Strict-Transport-Security", + "value" : "max-age=31536000" + }, { + "name" : "Vary", + "value" : "Accept-Encoding" + }, { + "name" : "X-Cache", + "value" : "Miss from cloudfront" + }, { + "name" : "Via", + "value" : "1.1 5dbe09af3a2c87121e31ffa67f174f66.cloudfront.net (CloudFront)" + }, { + "name" : "X-Amz-Cf-Id", + "value" : "YkvlkBNKgHt5aMu9vcS22Z8kHn1MUr-8adupwhDk3j9vF-TpSyIxZA==" + } ], + "headersSize" : 527, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "13.32.22.80", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 177, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 27, + "send" : -1, + "ssl" : -1, + "wait" : 150 + } + }, { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "*/*" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/resources" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + } ], + "method" : "GET", + "queryString" : [ ], + "url" : "https://use.typekit.net/cjy5myw.js" + }, + "response" : { + "bodySize" : 0, + "content" : { + "mimeType" : "text/javascript;charset=utf-8", + "size" : 7814 + }, + "headers" : [ { + "name" : "status", + "value" : "200" + }, { + "name" : "access-control-allow-origin", + "value" : "*" + }, { + "name" : "cache-control", + "value" : "public, max-age=600, stale-while-revalidate=604800" + }, { + "name" : "content-encoding", + "value" : "gzip" + }, { + "name" : "content-type", + "value" : "text/javascript;charset=utf-8" + }, { + "name" : "server", + "value" : "nginx" + }, { + "name" : "status", + "value" : "200 OK" + }, { + "name" : "timing-allow-origin", + "value" : "*" + }, { + "name" : "vary", + "value" : "Accept-Encoding" + }, { + "name" : "content-length", + "value" : "7814" + }, { + "name" : "date", + "value" : "Sun, 26 Mar 2017 11:58:43 GMT" + } ], + "headersSize" : 334, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "104.103.103.234", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 72, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 10, + "send" : -1, + "ssl" : -1, + "wait" : 62 + } + } ], + "pages" : [ { + "id" : "page_1", + "pageTimings" : { + "onContentLoad" : 874, + "onLoad" : 3492 + }, + "responseCode" : 200, + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "title" : "Network Performance Resources | ThousandEyes" + } ], + "version" : "1.2", + "systemMetrics" : { + "startTimeMs" : 1581508857327, + "endTimeMs" : 1581508867333, + "cpuUtilization" : { + "min" : 0.30859375, + "max" : 0.5625, + "mean" : 0.38931831001805056, + "median" : 0.353515625, + "stdDev" : 0.08389194281742307, + "count" : 10 + }, + "physicalMemoryUsedBytes" : { + "min" : 12805128192, + "max" : 12825530368, + "mean" : 1.281914582109091E10, + "median" : 12818219008, + "stdDev" : 5741124.05691331, + "count" : 11 + }, + "physicalMemoryTotalBytes" : 17069891584 + } + } + } + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_real_user_test_results": OperationExpectation( + operation_id="get_real_user_test_results", + method="GET", + path="/endpoint/test-results/real-user-tests/{id}", + path_param_examples={ + "id": '07625:1490529480:h3qJQTpl', + }, + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "errors" : [ "ping: Request timed out before getting response" ] + }, + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "errors" : [ "ping: Request timed out before getting response" ] + }, + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py new file mode 100644 index 00000000..40df274b --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py @@ -0,0 +1,2255 @@ +# 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 json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.http_server_endpoint_scheduled_test_results_api import HTTPServerEndpointScheduledTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBase): + """HTTPServerEndpointScheduledTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = HTTPServerEndpointScheduledTestResultsApi(self.api_client) + + + def test_get_http_server_scheduled_test_results_happy_path(self) -> None: + """Integration test for get_http_server_scheduled_test_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + response_body_json = """ + { + "test" : { + "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" + }, + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_http_server_scheduled_test_results_error_401(self) -> None: + """Integration test for get_http_server_scheduled_test_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_scheduled_test_results_error_403(self) -> None: + """Integration test for get_http_server_scheduled_test_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_scheduled_test_results_error_404(self) -> None: + """Integration test for get_http_server_scheduled_test_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_scheduled_test_results_error_429(self) -> None: + """Integration test for get_http_server_scheduled_test_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_scheduled_test_results_error_500(self) -> None: + """Integration test for get_http_server_scheduled_test_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_scheduled_test_results_error_502(self) -> None: + """Integration test for get_http_server_scheduled_test_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_happy_path(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + response_body_json = """ + { + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_400(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 400)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_401(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_403(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_404(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_429(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_500(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_multi_test_filtered_http_server_scheduled_test_results_error_502(self) -> None: + """Integration test for get_multi_test_filtered_http_server_scheduled_test_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_single_test_filtered_http_server_scheduled_test_results_happy_path(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + response_body_json = """ + { + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_400(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 400)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_401(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_403(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_404(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_429(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_500(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_single_test_filtered_http_server_scheduled_test_results_error_502(self) -> None: + """Integration test for get_single_test_filtered_http_server_scheduled_test_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] + 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_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py new file mode 100644 index 00000000..44db53f5 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py @@ -0,0 +1,1842 @@ +# 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 json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.local_network_endpoint_test_results_api import LocalNetworkEndpointTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): + """LocalNetworkEndpointTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = LocalNetworkEndpointTestResultsApi(self.api_client) + + + def test_filter_local_networks_test_results_topologies_happy_path(self) -> None: + """Integration test for filter_local_networks_test_results_topologies success path""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + } + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + } + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_local_networks_test_results_topologies_error_400(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 400)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_local_networks_test_results_topologies_error_401(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 401)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_local_networks_test_results_topologies_error_403(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 403)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_local_networks_test_results_topologies_error_404(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 404)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_local_networks_test_results_topologies_error_429(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 429)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_local_networks_test_results_topologies_error_500(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 500)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_local_networks_test_results_topologies_error_502(self) -> None: + """Integration test for filter_local_networks_test_results_topologies error path (HTTP 502)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_local_networks_test_results_happy_path(self) -> None: + """Integration test for get_local_networks_test_results success path""" + aid = '1234' + response_body_json = """ + { + "localNetworks" : [ { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" + }, { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" + } ], + "_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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_local_networks_test_results_error_401(self) -> None: + """Integration test for get_local_networks_test_results 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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_error_403(self) -> None: + """Integration test for get_local_networks_test_results 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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_error_404(self) -> None: + """Integration test for get_local_networks_test_results 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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_error_429(self) -> None: + """Integration test for get_local_networks_test_results 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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_error_500(self) -> None: + """Integration test for get_local_networks_test_results 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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_error_502(self) -> None: + """Integration test for get_local_networks_test_results 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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_local_networks_test_results_topology_happy_path(self) -> None: + """Integration test for get_local_networks_test_results_topology success path""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + } ], + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + } ], + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_local_networks_test_results_topology_error_401(self) -> None: + """Integration test for get_local_networks_test_results_topology error path (HTTP 401)""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_topology_error_403(self) -> None: + """Integration test for get_local_networks_test_results_topology error path (HTTP 403)""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_topology_error_404(self) -> None: + """Integration test for get_local_networks_test_results_topology error path (HTTP 404)""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_topology_error_429(self) -> None: + """Integration test for get_local_networks_test_results_topology error path (HTTP 429)""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_topology_error_500(self) -> None: + """Integration test for get_local_networks_test_results_topology error path (HTTP 500)""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_local_networks_test_results_topology_error_502(self) -> None: + """Integration test for get_local_networks_test_results_topology error path (HTTP 502)""" + network_topology_id = '00160:39c518560de9:1491651900:236e6f18' + aid = '1234' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] + 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_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py new file mode 100644 index 00000000..f3cc3f88 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py @@ -0,0 +1,2162 @@ +# 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 json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.network_dynamic_endpoint_test_results_api import NetworkDynamicEndpointTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): + """NetworkDynamicEndpointTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = NetworkDynamicEndpointTestResultsApi(self.api_client) + + + def test_filter_dynamic_test_network_results_happy_path(self) -> None: + """Integration test for filter_dynamic_test_network_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + response_body_json = """ + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + }, + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_dynamic_test_network_results_error_401(self) -> None: + """Integration test for filter_dynamic_test_network_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + 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.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_dynamic_test_network_results_error_403(self) -> None: + """Integration test for filter_dynamic_test_network_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + 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.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_dynamic_test_network_results_error_404(self) -> None: + """Integration test for filter_dynamic_test_network_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + 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.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_dynamic_test_network_results_error_429(self) -> None: + """Integration test for filter_dynamic_test_network_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + 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.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_dynamic_test_network_results_error_500(self) -> None: + """Integration test for filter_dynamic_test_network_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + 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.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_dynamic_test_network_results_error_502(self) -> None: + """Integration test for filter_dynamic_test_network_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] + 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.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dynamic_test_path_vis_agent_round_results_happy_path(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_400(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_401(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_403(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_404(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_429(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_500(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_agent_round_results_error_502(self) -> None: + """Integration test for get_dynamic_test_path_vis_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dynamic_test_path_vis_results_happy_path(self) -> None: + """Integration test for get_dynamic_test_path_vis_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + }, + "endDate" : "2022-07-18T22:00:54Z", + "totalHits" : 12, + "_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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dynamic_test_path_vis_results_error_401(self) -> None: + """Integration test for get_dynamic_test_path_vis_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_results_error_403(self) -> None: + """Integration test for get_dynamic_test_path_vis_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_results_error_404(self) -> None: + """Integration test for get_dynamic_test_path_vis_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_results_error_429(self) -> None: + """Integration test for get_dynamic_test_path_vis_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_results_error_500(self) -> None: + """Integration test for get_dynamic_test_path_vis_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dynamic_test_path_vis_results_error_502(self) -> None: + """Integration test for get_dynamic_test_path_vis_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py new file mode 100644 index 00000000..50b61984 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py @@ -0,0 +1,2784 @@ +# 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 json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.network_endpoint_scheduled_test_results_api import NetworkEndpointScheduledTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase): + """NetworkEndpointScheduledTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = NetworkEndpointScheduledTestResultsApi(self.api_client) + + + def test_filter_scheduled_test_network_results_happy_path(self) -> None: + """Integration test for filter_scheduled_test_network_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + response_body_json = """ + { + "test" : { + "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" + }, + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_scheduled_test_network_results_error_401(self) -> None: + """Integration test for filter_scheduled_test_network_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_test_network_results_error_403(self) -> None: + """Integration test for filter_scheduled_test_network_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_test_network_results_error_404(self) -> None: + """Integration test for filter_scheduled_test_network_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_test_network_results_error_429(self) -> None: + """Integration test for filter_scheduled_test_network_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_test_network_results_error_500(self) -> None: + """Integration test for filter_scheduled_test_network_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_test_network_results_error_502(self) -> None: + """Integration test for filter_scheduled_test_network_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_filter_scheduled_tests_network_results_happy_path(self) -> None: + """Integration test for filter_scheduled_tests_network_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + response_body_json = """ + { + "totalHits" : 12, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_scheduled_tests_network_results_error_401(self) -> None: + """Integration test for filter_scheduled_tests_network_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_tests_network_results_error_403(self) -> None: + """Integration test for filter_scheduled_tests_network_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_tests_network_results_error_404(self) -> None: + """Integration test for filter_scheduled_tests_network_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_tests_network_results_error_429(self) -> None: + """Integration test for filter_scheduled_tests_network_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_tests_network_results_error_500(self) -> None: + """Integration test for filter_scheduled_tests_network_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_scheduled_tests_network_results_error_502(self) -> None: + """Integration test for filter_scheduled_tests_network_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] + 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.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, + expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_scheduled_test_path_vis_agent_round_results_happy_path(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "test" : { + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_scheduled_test_path_vis_agent_round_results_error_401(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_agent_round_results_error_403(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_agent_round_results_error_404(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_agent_round_results_error_429(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_agent_round_results_error_500(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_agent_round_results_error_502(self) -> None: + """Integration test for get_scheduled_test_path_vis_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_scheduled_test_path_vis_results_happy_path(self) -> None: + """Integration test for get_scheduled_test_path_vis_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "test" : { + "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" + }, + "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" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_scheduled_test_path_vis_results_error_401(self) -> None: + """Integration test for get_scheduled_test_path_vis_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_results_error_403(self) -> None: + """Integration test for get_scheduled_test_path_vis_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_results_error_404(self) -> None: + """Integration test for get_scheduled_test_path_vis_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_results_error_429(self) -> None: + """Integration test for get_scheduled_test_path_vis_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_results_error_500(self) -> None: + """Integration test for get_scheduled_test_path_vis_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_scheduled_test_path_vis_results_error_502(self) -> None: + """Integration test for get_scheduled_test_path_vis_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py new file mode 100644 index 00000000..c333abea --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py @@ -0,0 +1,2554 @@ +# 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 json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.real_user_endpoint_test_results_api import RealUserEndpointTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): + """RealUserEndpointTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = RealUserEndpointTestResultsApi(self.api_client) + + + def test_filter_real_user_tests_network_results_happy_path(self) -> None: + """Integration test for filter_real_user_tests_network_results success path""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_real_user_tests_network_results_error_400(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 400)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_401(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_403(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_404(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_429(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_500(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_502(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_filter_real_user_tests_results_happy_path(self) -> None: + """Integration test for filter_real_user_tests_results success path""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_real_user_tests_results_error_400(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 400)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_401(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_403(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_404(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_429(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_500(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_502(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_filter_real_user_tests_visited_pages_results_happy_path(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results success path""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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" + } + }, + "results" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_real_user_tests_visited_pages_results_error_400(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 400)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_401(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 401)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_403(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 403)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_404(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 404)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_429(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 429)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_500(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 500)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_502(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 502)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + 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" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_real_user_test_page_results_happy_path(self) -> None: + """Integration test for get_real_user_test_page_results success path""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + 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" + } + }, + "har" : { + "log" : { + "browser" : { + "name" : "Google Chrome", + "version" : "57.0.2987.98" + }, + "creator" : { + "name" : "ThousandEyes Endpoint Agent", + "version" : "0.47.0" + }, + "entries" : [ { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "Upgrade-Insecure-Requests", + "value" : "1" + }, { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + }, { + "name" : "Cookie", + "value" : "(removed)" + } ], + "method" : "GET", + "queryString" : [ { + "name" : "locale", + "value" : "en-US" + } ], + "url" : "https://www.thousandeyes.com/resources" + }, + "response" : { + "bodySize" : 17776, + "content" : { + "mimeType" : "text/html;charset=ISO-8859-1", + "size" : 17776 + }, + "headers" : [ { + "name" : "Content-Type", + "value" : "text/html;charset=ISO-8859-1" + }, { + "name" : "Content-Length", + "value" : "17776" + }, { + "name" : "Connection", + "value" : "keep-alive" + }, { + "name" : "Date", + "value" : "Sun, 26 Mar 2017 11:58:54 GMT" + }, { + "name" : "Server", + "value" : "Apache" + }, { + "name" : "Cache-Control", + "value" : "max-age=600, must-revalidate" + }, { + "name" : "Content-Language", + "value" : "en-US" + }, { + "name" : "Content-Encoding", + "value" : "gzip" + }, { + "name" : "X-Frame-Options", + "value" : "sameorigin" + }, { + "name" : "Strict-Transport-Security", + "value" : "max-age=31536000" + }, { + "name" : "Vary", + "value" : "Accept-Encoding" + }, { + "name" : "X-Cache", + "value" : "Miss from cloudfront" + }, { + "name" : "Via", + "value" : "1.1 5dbe09af3a2c87121e31ffa67f174f66.cloudfront.net (CloudFront)" + }, { + "name" : "X-Amz-Cf-Id", + "value" : "YkvlkBNKgHt5aMu9vcS22Z8kHn1MUr-8adupwhDk3j9vF-TpSyIxZA==" + } ], + "headersSize" : 527, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "13.32.22.80", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 177, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 27, + "send" : -1, + "ssl" : -1, + "wait" : 150 + } + }, { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "*/*" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/resources" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + } ], + "method" : "GET", + "queryString" : [ ], + "url" : "https://use.typekit.net/cjy5myw.js" + }, + "response" : { + "bodySize" : 0, + "content" : { + "mimeType" : "text/javascript;charset=utf-8", + "size" : 7814 + }, + "headers" : [ { + "name" : "status", + "value" : "200" + }, { + "name" : "access-control-allow-origin", + "value" : "*" + }, { + "name" : "cache-control", + "value" : "public, max-age=600, stale-while-revalidate=604800" + }, { + "name" : "content-encoding", + "value" : "gzip" + }, { + "name" : "content-type", + "value" : "text/javascript;charset=utf-8" + }, { + "name" : "server", + "value" : "nginx" + }, { + "name" : "status", + "value" : "200 OK" + }, { + "name" : "timing-allow-origin", + "value" : "*" + }, { + "name" : "vary", + "value" : "Accept-Encoding" + }, { + "name" : "content-length", + "value" : "7814" + }, { + "name" : "date", + "value" : "Sun, 26 Mar 2017 11:58:43 GMT" + } ], + "headersSize" : 334, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "104.103.103.234", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 72, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 10, + "send" : -1, + "ssl" : -1, + "wait" : 62 + } + } ], + "pages" : [ { + "id" : "page_1", + "pageTimings" : { + "onContentLoad" : 874, + "onLoad" : 3492 + }, + "responseCode" : 200, + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "title" : "Network Performance Resources | ThousandEyes" + } ], + "version" : "1.2", + "systemMetrics" : { + "startTimeMs" : 1581508857327, + "endTimeMs" : 1581508867333, + "cpuUtilization" : { + "min" : 0.30859375, + "max" : 0.5625, + "mean" : 0.38931831001805056, + "median" : 0.353515625, + "stdDev" : 0.08389194281742307, + "count" : 10 + }, + "physicalMemoryUsedBytes" : { + "min" : 12805128192, + "max" : 12825530368, + "mean" : 1.281914582109091E10, + "median" : 12818219008, + "stdDev" : 5741124.05691331, + "count" : 11 + }, + "physicalMemoryTotalBytes" : 17069891584 + } + } + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_real_user_test_page_results_error_401(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 401)""" + id = '07625:1490529480:h3qJQTpl' + page_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_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_403(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 403)""" + id = '07625:1490529480:h3qJQTpl' + page_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_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_404(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 404)""" + id = '07625:1490529480:h3qJQTpl' + page_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_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_429(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 429)""" + id = '07625:1490529480:h3qJQTpl' + page_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_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_500(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 500)""" + id = '07625:1490529480:h3qJQTpl' + page_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_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_502(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 502)""" + id = '07625:1490529480:h3qJQTpl' + page_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_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_real_user_test_results_happy_path(self) -> None: + """Integration test for get_real_user_test_results success path""" + id = '07625:1490529480:h3qJQTpl' + 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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "errors" : [ "ping: Request timed out before getting response" ] + }, + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "<direct>" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "errors" : [ "ping: Request timed out before getting response" ] + }, + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_real_user_test_results_error_401(self) -> None: + """Integration test for get_real_user_test_results error path (HTTP 401)""" + id = '07625:1490529480:h3qJQTpl' + 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_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_results_error_403(self) -> None: + """Integration test for get_real_user_test_results error path (HTTP 403)""" + id = '07625:1490529480:h3qJQTpl' + 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_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_results_error_404(self) -> None: + """Integration test for get_real_user_test_results error path (HTTP 404)""" + id = '07625:1490529480:h3qJQTpl' + 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_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_results_error_429(self) -> None: + """Integration test for get_real_user_test_results error path (HTTP 429)""" + id = '07625:1490529480:h3qJQTpl' + 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_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_results_error_500(self) -> None: + """Integration test for get_real_user_test_results error path (HTTP 500)""" + id = '07625:1490529480:h3qJQTpl' + 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_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_results_error_502(self) -> None: + """Integration test for get_real_user_test_results error path (HTTP 502)""" + id = '07625:1490529480:h3qJQTpl' + 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_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-tests/test/conftest.py b/thousandeyes-sdk-endpoint-tests/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py new file mode 100644 index 00000000..5a1cf965 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-endpoint-tests/test/mock_manifest.py b/thousandeyes-sdk-endpoint-tests/test/mock_manifest.py new file mode 100644 index 00000000..5f8f0d5e --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/mock_manifest.py @@ -0,0 +1,2809 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="create_agent_to_server_endpoint_dynamic_test", + method="POST", + path="/endpoint/tests/dynamic-tests/agent-to-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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(""" + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "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" : 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="delete_agent_to_server_endpoint_dynamic_test", + method="DELETE", + path="/endpoint/tests/dynamic-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=204, + success_body=None, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="get_agent_to_server_endpoint_dynamic_test", + method="GET", + path="/endpoint/tests/dynamic-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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=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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_dynamic_tests": OperationExpectation( + operation_id="get_agent_to_server_endpoint_dynamic_tests", + method="GET", + path="/endpoint/tests/dynamic-tests/agent-to-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + }, { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + } + } + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="update_agent_to_server_endpoint_dynamic_test", + method="PATCH", + path="/endpoint/tests/dynamic-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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(""" + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "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" : 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="create_agent_to_server_endpoint_scheduled_test", + method="POST", + path="/endpoint/tests/scheduled-tests/agent-to-server", + 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", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "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" : 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="delete_agent_to_server_endpoint_scheduled_test", + method="DELETE", + path="/endpoint/tests/scheduled-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=204, + success_body=None, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="get_agent_to_server_endpoint_scheduled_test", + method="GET", + path="/endpoint/tests/scheduled-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + 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=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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_scheduled_tests": OperationExpectation( + operation_id="get_agent_to_server_endpoint_scheduled_tests", + method="GET", + path="/endpoint/tests/scheduled-tests/agent-to-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + } + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="update_agent_to_server_endpoint_scheduled_test", + method="PATCH", + path="/endpoint/tests/scheduled-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + 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", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "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" : 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_real_user_tests": OperationExpectation( + operation_id="get_endpoint_real_user_tests", + method="GET", + path="/endpoint/tests/real-user-tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_scheduled_tests": OperationExpectation( + operation_id="get_endpoint_scheduled_tests", + method="GET", + path="/endpoint/tests/scheduled-tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + } + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="create_http_server_endpoint_scheduled_test", + method="POST", + path="/endpoint/tests/scheduled-tests/http-server", + 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, + "isPrioritized" : false, + "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, + "interval" : 60, + "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" : 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="delete_http_server_endpoint_scheduled_test", + method="DELETE", + path="/endpoint/tests/scheduled-tests/http-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=204, + success_body=None, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="get_http_server_endpoint_scheduled_test", + method="GET", + path="/endpoint/tests/scheduled-tests/http-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + 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=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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_endpoint_scheduled_tests": OperationExpectation( + operation_id="get_http_server_endpoint_scheduled_tests", + method="GET", + path="/endpoint/tests/scheduled-tests/http-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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" + }, { + "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" + } ], + "_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", + ), + + "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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="update_http_server_endpoint_scheduled_test", + method="PATCH", + path="/endpoint/tests/scheduled-tests/http-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + 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(""" + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "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" : 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py new file mode 100644 index 00000000..a8a0da2f --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py @@ -0,0 +1,1435 @@ +# 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.agent_to_server_endpoint_dynamic_tests_api import AgentToServerEndpointDynamicTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): + """AgentToServerEndpointDynamicTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AgentToServerEndpointDynamicTestsApi(self.api_client) + + + def test_create_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test success path""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_400(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 400)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_401(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 401)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_403(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 403)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_404(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 404)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_429(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 429)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_500(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 500)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_dynamic_test_error_502(self) -> None: + """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 502)""" + request_body_json = """ + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """ + dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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(502) + ) as context: + self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test success path""" + test_id = '584739201' + aid = '1234' + response = self.api.delete_agent_to_server_endpoint_dynamic_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_400(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 400)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_401(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 401)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_403(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 403)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_404(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 404)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_429(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 429)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_500(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 500)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_dynamic_test_error_502(self) -> None: + """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 502)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test success path""" + test_id = '584739201' + aid = '1234' + response_body_json = """ + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_server_endpoint_dynamic_test_error_401(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 401)""" + test_id = '584739201' + 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_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_test_error_403(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 403)""" + test_id = '584739201' + 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_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_test_error_404(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 404)""" + test_id = '584739201' + 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_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_test_error_429(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 429)""" + test_id = '584739201' + 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_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_test_error_500(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 500)""" + test_id = '584739201' + 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_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_test_error_502(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 502)""" + test_id = '584739201' + 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_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_server_endpoint_dynamic_tests_happy_path(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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" + }, { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_server_endpoint_dynamic_tests_error_401(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_tests_error_403(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_tests_error_429(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_tests_error_500(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_dynamic_tests_error_502(self) -> None: + """Integration test for get_agent_to_server_endpoint_dynamic_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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test success path""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + aid = '1234' + response_body_json = """ + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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, + "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", + "application" : "webex", + "hasTraceroute" : true, + "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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_400(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 400)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_401(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 401)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_403(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 403)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_404(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 404)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_429(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 429)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_500(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 500)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_dynamic_test_error_502(self) -> None: + """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 502)""" + request_body_json = """ + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py new file mode 100644 index 00000000..0832178d --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py @@ -0,0 +1,1448 @@ +# 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.agent_to_server_endpoint_scheduled_tests_api import AgentToServerEndpointScheduledTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): + """AgentToServerEndpointScheduledTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AgentToServerEndpointScheduledTestsApi(self.api_client) + + + def test_create_agent_to_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test success path""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_400(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 400)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 401)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 403)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 404)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 429)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 500)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for create_agent_to_server_endpoint_scheduled_test error path (HTTP 502)""" + request_body_json = """ + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """ + endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointAgentToServerTestRequest.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(502) + ) as context: + self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_agent_to_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test success path""" + test_id = '584739201' + aid = '1234' + response = self.api.delete_agent_to_server_endpoint_scheduled_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_400(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 400)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 401)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 403)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 404)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 429)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 500)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for delete_agent_to_server_endpoint_scheduled_test error path (HTTP 502)""" + test_id = '584739201' + 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.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test success path""" + test_id = '584739201' + 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.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test error path (HTTP 401)""" + test_id = '584739201' + 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_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test error path (HTTP 403)""" + test_id = '584739201' + 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_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test error path (HTTP 404)""" + test_id = '584739201' + 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_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test error path (HTTP 429)""" + test_id = '584739201' + 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_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test error path (HTTP 500)""" + test_id = '584739201' + 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_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for get_agent_to_server_endpoint_scheduled_test error path (HTTP 502)""" + test_id = '584739201' + 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_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_server_endpoint_scheduled_tests_happy_path(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_server_endpoint_scheduled_tests_error_401(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_tests_error_403(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_tests_error_429(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_tests_error_500(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_endpoint_scheduled_tests_error_502(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_agent_to_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test success path""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_400(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 400)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 401)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 403)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 404)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 429)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 500)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for update_agent_to_server_endpoint_scheduled_test error path (HTTP 502)""" + request_body_json = """ + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """ + endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointNetworkTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py new file mode 100644 index 00000000..108dd3e9 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py new file mode 100644 index 00000000..9d5dc743 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py new file mode 100644 index 00000000..c981d73b --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py @@ -0,0 +1,1575 @@ +# 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.http_server_endpoint_scheduled_tests_api import HTTPServerEndpointScheduledTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): + """HTTPServerEndpointScheduledTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = HTTPServerEndpointScheduledTestsApi(self.api_client) + + + def test_create_http_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_http_server_endpoint_scheduled_test_error_400(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_test error path (HTTP 404)""" + request_body_json = """ + + { + "verifyCertificate" : true, + "hasPing" : true, + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for create_http_server_endpoint_scheduled_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, + "isPrioritized" : false, + "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, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """ + endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.models.EndpointHttpServerTestRequest.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(502) + ) as context: + self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_http_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test success path""" + test_id = '584739201' + aid = '1234' + response = self.api.delete_http_server_endpoint_scheduled_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_http_server_endpoint_scheduled_test_error_400(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 400)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 401)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 403)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 404)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 429)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 500)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for delete_http_server_endpoint_scheduled_test error path (HTTP 502)""" + test_id = '584739201' + 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.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_http_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test success path""" + test_id = '584739201' + 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.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_http_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test error path (HTTP 401)""" + test_id = '584739201' + 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_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test error path (HTTP 403)""" + test_id = '584739201' + 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_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test error path (HTTP 404)""" + test_id = '584739201' + 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_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test error path (HTTP 429)""" + test_id = '584739201' + 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_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test error path (HTTP 500)""" + test_id = '584739201' + 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_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_test error path (HTTP 502)""" + test_id = '584739201' + 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_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_http_server_endpoint_scheduled_tests_happy_path(self) -> None: + """Integration test for get_http_server_endpoint_scheduled_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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" + }, { + "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" + } ], + "_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_http_server_endpoint_scheduled_tests_error_401(self) -> None: + """Integration test for get_http_server_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_tests_error_403(self) -> None: + """Integration test for get_http_server_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_tests_error_429(self) -> None: + """Integration test for get_http_server_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_tests_error_500(self) -> None: + """Integration test for get_http_server_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_endpoint_scheduled_tests_error_502(self) -> None: + """Integration test for get_http_server_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_http_server_endpoint_scheduled_test_happy_path(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test success path""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_http_server_endpoint_scheduled_test_error_400(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 400)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_endpoint_scheduled_test_error_401(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 401)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_endpoint_scheduled_test_error_403(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 403)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_endpoint_scheduled_test_error_404(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 404)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_endpoint_scheduled_test_error_429(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 429)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_endpoint_scheduled_test_error_500(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 500)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_endpoint_scheduled_test_error_502(self) -> None: + """Integration test for update_http_server_endpoint_scheduled_test error path (HTTP 502)""" + request_body_json = """ + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """ + endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointHttpTestUpdate.from_json(request_body_json) + test_id = '584739201' + 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.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-event-detection/test/conftest.py b/thousandeyes-sdk-event-detection/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-event-detection/test/integration_test_utils.py b/thousandeyes-sdk-event-detection/test/integration_test_utils.py new file mode 100644 index 00000000..bb20b37c --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-event-detection/test/mock_manifest.py b/thousandeyes-sdk-event-detection/test/mock_manifest.py new file mode 100644 index 00000000..f5715b1d --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/mock_manifest.py @@ -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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-event-detection/test/test_events_api_integration.py b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py new file mode 100644 index 00000000..81cdb18c --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/conftest.py b/thousandeyes-sdk-instant-tests/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-instant-tests/test/integration_test_utils.py b/thousandeyes-sdk-instant-tests/test/integration_test_utils.py new file mode 100644 index 00000000..b4de1e4f --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-instant-tests/test/mock_manifest.py b/thousandeyes-sdk-instant-tests/test/mock_manifest.py new file mode 100644 index 00000000..be288d75 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/mock_manifest.py @@ -0,0 +1,3980 @@ +# 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 + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_api_instant_test": OperationExpectation( + operation_id="create_api_instant_test", + method="POST", + path="/tests/api/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "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" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_agent_instant_test": OperationExpectation( + operation_id="create_agent_to_agent_instant_test", + method="POST", + path="/tests/agent-to-agent/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_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" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_server_instant_test": OperationExpectation( + operation_id="create_agent_to_server_instant_test", + method="POST", + path="/tests/agent-to-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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 + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_sec_instant_test": OperationExpectation( + operation_id="create_dns_sec_instant_test", + method="POST", + path="/tests/dnssec/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_server_instant_test": OperationExpectation( + operation_id="create_dns_server_instant_test", + method="POST", + path="/tests/dns-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_trace_instant_test": OperationExpectation( + operation_id="create_dns_trace_instant_test", + method="POST", + path="/tests/dns-trace/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_ftp_server_instant_test": OperationExpectation( + operation_id="create_ftp_server_instant_test", + method="POST", + path="/tests/ftp-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_page_load_instant_test": OperationExpectation( + operation_id="create_page_load_instant_test", + method="POST", + path="/tests/page-load/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_instant_test": OperationExpectation( + operation_id="create_http_server_instant_test", + method="POST", + path="/tests/http-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_sip_server_instant_test": OperationExpectation( + operation_id="create_sip_server_instant_test", + method="POST", + path="/tests/sip-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_voice_instant_test": OperationExpectation( + operation_id="create_voice_instant_test", + method="POST", + path="/tests/voice/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_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" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_web_transaction_instant_test": OperationExpectation( + operation_id="create_web_transaction_instant_test", + method="POST", + path="/tests/web-transactions/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py new file mode 100644 index 00000000..1602eeaf --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py new file mode 100644 index 00000000..83febcd6 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py new file mode 100644 index 00000000..1f8772a1 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py @@ -0,0 +1,1716 @@ +# 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.api_instant_tests_api import APIInstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAPIInstantTestsApiIntegration(IntegrationTestBase): + """APIInstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = APIInstantTestsApi(self.api_client) + + + def test_create_api_instant_test_happy_path(self) -> None: + """Integration test for create_api_instant_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "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" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_api_instant_test_error_400(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_instant_test_error_401(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_instant_test_error_403(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_instant_test_error_404(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_instant_test_error_429(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_instant_test_error_500(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_instant_test_error_502(self) -> None: + """Integration test for create_api_instant_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """ + api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.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_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py new file mode 100644 index 00000000..12b0c892 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py new file mode 100644 index 00000000..7c6179a9 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py new file mode 100644 index 00000000..796c6d4a --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py new file mode 100644 index 00000000..2ee0292b --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py new file mode 100644 index 00000000..b01ae095 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py @@ -0,0 +1,1392 @@ +# 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.http_page_load_instant_tests_api import HTTPPageLoadInstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): + """HTTPPageLoadInstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = HTTPPageLoadInstantTestsApi(self.api_client) + + + def test_create_page_load_instant_test_happy_path(self) -> None: + """Integration test for create_page_load_instant_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_page_load_instant_test_error_400(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_instant_test_error_401(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_instant_test_error_403(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_instant_test_error_404(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_instant_test_error_429(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_instant_test_error_500(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_instant_test_error_502(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.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_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py new file mode 100644 index 00000000..75a37408 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py @@ -0,0 +1,1320 @@ +# 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.http_server_instant_tests_api import HTTPServerInstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): + """HTTPServerInstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = HTTPServerInstantTestsApi(self.api_client) + + + def test_create_http_server_instant_test_happy_path(self) -> None: + """Integration test for create_http_server_instant_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \"example\" : \"value\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_http_server_instant_test_error_400(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_instant_test_error_401(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_instant_test_error_403(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_instant_test_error_404(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_instant_test_error_429(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_instant_test_error_500(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_instant_test_error_502(self) -> None: + """Integration test for create_http_server_instant_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.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_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-instant-tests/test/test_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_instant_tests_api_integration.py new file mode 100644 index 00000000..67b19d69 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py new file mode 100644 index 00000000..290e480f --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py new file mode 100644 index 00000000..4d38f339 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py @@ -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() diff --git a/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py new file mode 100644 index 00000000..8c03e305 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py @@ -0,0 +1,1410 @@ +# 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.web_transaction_instant_tests_api import WebTransactionInstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): + """WebTransactionInstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebTransactionInstantTestsApi(self.api_client) + + + def test_create_web_transaction_instant_test_happy_path(self) -> None: + """Integration test for create_web_transaction_instant_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_web_transaction_instant_test_error_400(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transaction_instant_test_error_401(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transaction_instant_test_error_403(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transaction_instant_test_error_404(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transaction_instant_test_error_429(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transaction_instant_test_error_500(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transaction_instant_test_error_502(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.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_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-internet-insights/test/conftest.py b/thousandeyes-sdk-internet-insights/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-internet-insights/test/integration_test_utils.py b/thousandeyes-sdk-internet-insights/test/integration_test_utils.py new file mode 100644 index 00000000..693c4b1e --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/integration_test_utils.py @@ -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 diff --git a/thousandeyes-sdk-internet-insights/test/mock_manifest.py b/thousandeyes-sdk-internet-insights/test/mock_manifest.py new file mode 100644 index 00000000..c925a517 --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/mock_manifest.py @@ -0,0 +1,899 @@ +# 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 json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "filter_catalog_providers": OperationExpectation( + operation_id="filter_catalog_providers", + method="POST", + path="/internet-insights/catalog/providers/filter", + 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" + } + }, + "providers" : [ { + "interfacesCount" : 15, + "locationsCount" : 50, + "_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" + } + }, + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + }, { + "interfacesCount" : 15, + "locationsCount" : 50, + "_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" + } + }, + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """), + 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", + ), + + }, + ), + + "get_catalog_provider": OperationExpectation( + operation_id="get_catalog_provider", + method="GET", + path="/internet-insights/catalog/providers/{providerId}", + path_param_examples={ + "providerId": '85602a0a-54a7-4e97-946e-67492ef1fa26', + }, + 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" + } + }, + "dataType" : "Application", + "asns" : [ { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 + }, { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 + } ], + "locations" : [ { + "interfacesCount" : 5, + "location" : "San Jose, US" + }, { + "interfacesCount" : 5, + "location" : "San Jose, US" + } ], + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + } + + """), + + 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", + ), + + }, + ), + + "filter_outages": OperationExpectation( + operation_id="filter_outages", + method="POST", + path="/internet-insights/outages/filter", + 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" + } + }, + "outages" : [ { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_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" + } + }, + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" + }, { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_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" + } + }, + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """), + 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", + ), + + }, + ), + + "get_app_outage": OperationExpectation( + operation_id="get_app_outage", + method="GET", + path="/internet-insights/outages/app/{outageId}", + path_param_examples={ + "outageId": 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0', + }, + success_status=200, + success_body=json.loads(""" + + { + "affectedDomains" : [ "amazon.com", "amazon.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 + }, { + "name" : "amazon-test2", + "id" : 5 + } ], + "endDate" : "2023-01-27T20:53:51.256Z", + "_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" + } + }, + "endRoundId" : 1674852600, + "providerType" : "SAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 + }, { + "name" : "London, England", + "id" : 11 + } ], + "id" : "0CC4C4209887126DE42E92252FB43962CBB3193147F318EA", + "providerName" : "Amazon Web Services", + "applicationName" : "Amazon Web Services", + "startDate" : "2023-01-27T20:50:51.256Z", + "errors" : [ "HTTP_SERVER_TIMEOUT", "HTTP_SERVER_TIMEOUT" ], + "affectedLocations" : [ { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + }, { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + } ] + }, { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + }, { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + } ] + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_network_outage": OperationExpectation( + operation_id="get_network_outage", + method="GET", + path="/internet-insights/outages/net/{outageId}", + path_param_examples={ + "outageId": '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F', + }, + success_status=200, + success_body=json.loads(""" + + { + "affectedDomains" : [ "periodic-failure.com", "periodic-failure.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 + }, { + "name" : "amazon-test2", + "id" : 5 + } ], + "endDate" : "2023-01-27T20:53:51.256Z", + "_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" + } + }, + "networkName" : "Rackspace Hosting", + "endRoundId" : 1674852600, + "providerType" : "IAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 + }, { + "name" : "London, England", + "id" : 11 + } ], + "id" : "8EF2760862C705783A2F8BCBAAABB44F28DBC670DBA3B610", + "asn" : 19994, + "providerName" : "Rackspace", + "startDate" : "2023-01-27T20:50:51.256Z", + "affectedLocations" : [ { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" + }, { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" + } ] + } + + """), + + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py b/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py new file mode 100644 index 00000000..ccf660a3 --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py @@ -0,0 +1,621 @@ +# 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 json +import unittest +import thousandeyes_sdk.internet_insights.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.internet_insights.api.internet_insights_catalog_providers_api import InternetInsightsCatalogProvidersApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): + """InternetInsightsCatalogProvidersApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = InternetInsightsCatalogProvidersApi(self.api_client) + + + def test_filter_catalog_providers_happy_path(self) -> None: + """Integration test for filter_catalog_providers success path""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.from_json(request_body_json) + 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" + } + }, + "providers" : [ { + "interfacesCount" : 15, + "locationsCount" : 50, + "_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" + } + }, + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + }, { + "interfacesCount" : 15, + "locationsCount" : 50, + "_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" + } + }, + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_catalog_providers_error_400(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 400)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_catalog_providers_error_401(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 401)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_catalog_providers_error_403(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 403)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_catalog_providers_error_404(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 404)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_catalog_providers_error_429(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 429)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_catalog_providers_error_500(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 500)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_catalog_providers_error_502(self) -> None: + """Integration test for filter_catalog_providers error path (HTTP 502)""" + request_body_json = """ + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """ + api_catalog_provider_filter = thousandeyes_sdk.internet_insights.models.ApiCatalogProviderFilter.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.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_catalog_provider_happy_path(self) -> None: + """Integration test for get_catalog_provider success path""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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" + } + }, + "dataType" : "Application", + "asns" : [ { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 + }, { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 + } ], + "locations" : [ { + "interfacesCount" : 5, + "location" : "San Jose, US" + }, { + "interfacesCount" : 5, + "location" : "San Jose, US" + } ], + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_catalog_provider_error_400(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 400)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_catalog_provider_error_401(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 401)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_catalog_provider_error_403(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 403)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_catalog_provider_error_404(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 404)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_catalog_provider_error_429(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 429)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_catalog_provider_error_500(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 500)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_catalog_provider_error_502(self) -> None: + """Integration test for get_catalog_provider error path (HTTP 502)""" + provider_id = '85602a0a-54a7-4e97-946e-67492ef1fa26' + 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_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py b/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py new file mode 100644 index 00000000..765de76e --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py @@ -0,0 +1,900 @@ +# 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 json +import unittest +import thousandeyes_sdk.internet_insights.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.internet_insights.api.internet_insights_outages_api import InternetInsightsOutagesApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): + """InternetInsightsOutagesApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = InternetInsightsOutagesApi(self.api_client) + + + def test_filter_outages_happy_path(self) -> None: + """Integration test for filter_outages success path""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json) + 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" + } + }, + "outages" : [ { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_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" + } + }, + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" + }, { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_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" + } + }, + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_outages_error_400(self) -> None: + """Integration test for filter_outages error path (HTTP 400)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_outages_error_401(self) -> None: + """Integration test for filter_outages error path (HTTP 401)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_outages_error_403(self) -> None: + """Integration test for filter_outages error path (HTTP 403)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_outages_error_404(self) -> None: + """Integration test for filter_outages error path (HTTP 404)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_outages_error_429(self) -> None: + """Integration test for filter_outages error path (HTTP 429)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_outages_error_500(self) -> None: + """Integration test for filter_outages error path (HTTP 500)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_outages_error_502(self) -> None: + """Integration test for filter_outages error path (HTTP 502)""" + request_body_json = """ + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """ + api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_app_outage_happy_path(self) -> None: + """Integration test for get_app_outage success path""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + aid = '1234' + response_body_json = """ + { + "affectedDomains" : [ "amazon.com", "amazon.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 + }, { + "name" : "amazon-test2", + "id" : 5 + } ], + "endDate" : "2023-01-27T20:53:51.256Z", + "_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" + } + }, + "endRoundId" : 1674852600, + "providerType" : "SAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 + }, { + "name" : "London, England", + "id" : 11 + } ], + "id" : "0CC4C4209887126DE42E92252FB43962CBB3193147F318EA", + "providerName" : "Amazon Web Services", + "applicationName" : "Amazon Web Services", + "startDate" : "2023-01-27T20:50:51.256Z", + "errors" : [ "HTTP_SERVER_TIMEOUT", "HTTP_SERVER_TIMEOUT" ], + "affectedLocations" : [ { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + }, { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + } ] + }, { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + }, { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_app_outage_error_400(self) -> None: + """Integration test for get_app_outage error path (HTTP 400)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_app_outage_error_401(self) -> None: + """Integration test for get_app_outage error path (HTTP 401)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_app_outage_error_403(self) -> None: + """Integration test for get_app_outage error path (HTTP 403)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_app_outage_error_404(self) -> None: + """Integration test for get_app_outage error path (HTTP 404)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_app_outage_error_429(self) -> None: + """Integration test for get_app_outage error path (HTTP 429)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_app_outage_error_500(self) -> None: + """Integration test for get_app_outage error path (HTTP 500)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_app_outage_error_502(self) -> None: + """Integration test for get_app_outage error path (HTTP 502)""" + outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0' + 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_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_network_outage_happy_path(self) -> None: + """Integration test for get_network_outage success path""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + aid = '1234' + response_body_json = """ + { + "affectedDomains" : [ "periodic-failure.com", "periodic-failure.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 + }, { + "name" : "amazon-test2", + "id" : 5 + } ], + "endDate" : "2023-01-27T20:53:51.256Z", + "_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" + } + }, + "networkName" : "Rackspace Hosting", + "endRoundId" : 1674852600, + "providerType" : "IAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 + }, { + "name" : "London, England", + "id" : 11 + } ], + "id" : "8EF2760862C705783A2F8BCBAAABB44F28DBC670DBA3B610", + "asn" : 19994, + "providerName" : "Rackspace", + "startDate" : "2023-01-27T20:50:51.256Z", + "affectedLocations" : [ { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" + }, { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_network_outage_error_400(self) -> None: + """Integration test for get_network_outage error path (HTTP 400)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_network_outage_error_401(self) -> None: + """Integration test for get_network_outage error path (HTTP 401)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_network_outage_error_403(self) -> None: + """Integration test for get_network_outage error path (HTTP 403)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_network_outage_error_404(self) -> None: + """Integration test for get_network_outage error path (HTTP 404)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_network_outage_error_429(self) -> None: + """Integration test for get_network_outage error path (HTTP 429)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_network_outage_error_500(self) -> None: + """Integration test for get_network_outage error path (HTTP 500)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_network_outage_error_502(self) -> None: + """Integration test for get_network_outage error path (HTTP 502)""" + outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F' + 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_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-snapshots/test/conftest.py b/thousandeyes-sdk-snapshots/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-snapshots/test/integration_test_utils.py b/thousandeyes-sdk-snapshots/test/integration_test_utils.py new file mode 100644 index 00000000..f7109bbb --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Test Snapshots API + + Creates a new test snapshot 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 diff --git a/thousandeyes-sdk-snapshots/test/mock_manifest.py b/thousandeyes-sdk-snapshots/test/mock_manifest.py new file mode 100644 index 00000000..0b88c58d --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/mock_manifest.py @@ -0,0 +1,213 @@ +# coding: utf-8 + +""" + Test Snapshots API + + Creates a new test snapshot in ThousandEyes. + + 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_test_snapshot": OperationExpectation( + operation_id="create_test_snapshot", + method="POST", + path="/tests/{testId}/snapshot", + path_param_examples={ + "testId": '202701', + }, + success_status=201, + success_body=json.loads(""" + + { + "shareDate" : "2023-06-06T00:00:00Z", + "uid" : "281474976810911", + "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" + }, + "_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" + }, + "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" + } + }, + "startRoundId" : 1538784000, + "displayName" : "Snapshot created through API", + "endRoundId" : 1538787600, + "testId" : "281474976710801", + "extraParams" : "params", + "id" : "wdiac", + "roundId" : 1538784000, + "sourceTestId" : "281474976710706" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """), + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py b/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py new file mode 100644 index 00000000..1b6e9ce5 --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py @@ -0,0 +1,395 @@ +# coding: utf-8 + +""" + Test Snapshots API + + Creates a new test snapshot 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.snapshots.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.snapshots.api.test_snapshots_api import TestSnapshotsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestTestSnapshotsApiIntegration(IntegrationTestBase): + """TestSnapshotsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = TestSnapshotsApi(self.api_client) + + + def test_create_test_snapshot_happy_path(self) -> None: + """Integration test for create_test_snapshot success path""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + response_body_json = """ + { + "shareDate" : "2023-06-06T00:00:00Z", + "uid" : "281474976810911", + "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" + }, + "_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" + }, + "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" + } + }, + "startRoundId" : 1538784000, + "displayName" : "Snapshot created through API", + "endRoundId" : 1538787600, + "testId" : "281474976710801", + "extraParams" : "params", + "id" : "wdiac", + "roundId" : 1538784000, + "sourceTestId" : "281474976710706" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_test_snapshot_error_400(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 400)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_test_snapshot_error_401(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 401)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_test_snapshot_error_403(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 403)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_test_snapshot_error_404(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 404)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_test_snapshot_error_429(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 429)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_test_snapshot_error_500(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 500)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_test_snapshot_error_502(self) -> None: + """Integration test for create_test_snapshot error path (HTTP 502)""" + request_body_json = """ + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """ + snapshot_request = thousandeyes_sdk.snapshots.models.SnapshotRequest.from_json(request_body_json) + test_id = '202701' + 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_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-streaming/test/conftest.py b/thousandeyes-sdk-streaming/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-streaming/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-streaming/test/integration_test_utils.py b/thousandeyes-sdk-streaming/test/integration_test_utils.py new file mode 100644 index 00000000..20108a9f --- /dev/null +++ b/thousandeyes-sdk-streaming/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC * Splunk Observability APM * Dynatrace Observability APM ThousandEyes for OpenTelemetry provides machine-to-machine integration between ThousandEyes and its customers. It allows you to export ThousandEyes telemetry data in OTel format, which is widely used in the industry. With ThousandEyes for OTel, you can leverage frameworks widely used in the observability domain - such as Splunk, Grafana, and Honeycomb - to capture and analyze ThousandEyes data. Any client that supports OTel can use ThousandEyes for OpenTelemetry. ThousandEyes for OTel is made up of the following components: * Data streaming APIs that you can use to configure and enable your ThousandEyes tests with OTel-compatible streams, in particular to configure how ThousandEyes telemetry data is exported to client integrations. * A set of streaming pipelines called _collectors_ that actively fetch ThousandEyes network test data, enrich the data with some additional detail, filter, and push the data to the customer-configured endpoints, depending on what you configure via the public APIs. * Third-party OTel collectors that receive, transform, filter, and export different metrics to client applications such as AppD, or any other OTel-capable client configuration. For more information about ThousandEyes for OpenTelemetry, see the [product documentation](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry). + + 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 diff --git a/thousandeyes-sdk-streaming/test/mock_manifest.py b/thousandeyes-sdk-streaming/test/mock_manifest.py new file mode 100644 index 00000000..88dd4618 --- /dev/null +++ b/thousandeyes-sdk-streaming/test/mock_manifest.py @@ -0,0 +1,759 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC * Splunk Observability APM * Dynatrace Observability APM ThousandEyes for OpenTelemetry provides machine-to-machine integration between ThousandEyes and its customers. It allows you to export ThousandEyes telemetry data in OTel format, which is widely used in the industry. With ThousandEyes for OTel, you can leverage frameworks widely used in the observability domain - such as Splunk, Grafana, and Honeycomb - to capture and analyze ThousandEyes data. Any client that supports OTel can use ThousandEyes for OpenTelemetry. ThousandEyes for OTel is made up of the following components: * Data streaming APIs that you can use to configure and enable your ThousandEyes tests with OTel-compatible streams, in particular to configure how ThousandEyes telemetry data is exported to client integrations. * A set of streaming pipelines called _collectors_ that actively fetch ThousandEyes network test data, enrich the data with some additional detail, filter, and push the data to the customer-configured endpoints, depending on what you configure via the public APIs. * Third-party OTel collectors that receive, transform, filter, and export different metrics to client applications such as AppD, or any other OTel-capable client configuration. For more information about ThousandEyes for OpenTelemetry, see the [product documentation](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry). + + 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_stream": OperationExpectation( + operation_id="create_stream", + method="POST", + path="/streams", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "createdBy" : 3962 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "412": ErrorResponseExpectation( + status=412, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "PRECONDITION_FAILED", + "errors" : [ "User cannot create more than 5 integrations", "User cannot create more than 5 integrations" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_stream": OperationExpectation( + operation_id="delete_stream", + method="DELETE", + path="/streams/{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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_stream": OperationExpectation( + operation_id="get_stream", + method="GET", + path="/streams/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_streams": OperationExpectation( + operation_id="get_streams", + method="GET", + path="/streams", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + [ { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + }, { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } ] + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_stream": OperationExpectation( + operation_id="update_stream", + method="PUT", + path="/streams/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py new file mode 100644 index 00000000..55530ef0 --- /dev/null +++ b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py @@ -0,0 +1,1358 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC * Splunk Observability APM * Dynatrace Observability APM ThousandEyes for OpenTelemetry provides machine-to-machine integration between ThousandEyes and its customers. It allows you to export ThousandEyes telemetry data in OTel format, which is widely used in the industry. With ThousandEyes for OTel, you can leverage frameworks widely used in the observability domain - such as Splunk, Grafana, and Honeycomb - to capture and analyze ThousandEyes data. Any client that supports OTel can use ThousandEyes for OpenTelemetry. ThousandEyes for OTel is made up of the following components: * Data streaming APIs that you can use to configure and enable your ThousandEyes tests with OTel-compatible streams, in particular to configure how ThousandEyes telemetry data is exported to client integrations. * A set of streaming pipelines called _collectors_ that actively fetch ThousandEyes network test data, enrich the data with some additional detail, filter, and push the data to the customer-configured endpoints, depending on what you configure via the public APIs. * Third-party OTel collectors that receive, transform, filter, and export different metrics to client applications such as AppD, or any other OTel-capable client configuration. For more information about ThousandEyes for OpenTelemetry, see the [product documentation](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.streaming.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.streaming.api.streaming_api import StreamingApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestStreamingApiIntegration(IntegrationTestBase): + """StreamingApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = StreamingApi(self.api_client) + + + def test_create_stream_happy_path(self) -> None: + """Integration test for create_stream success path""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "createdBy" : 3962 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_stream_error_400(self) -> None: + """Integration test for create_stream error path (HTTP 400)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_stream_error_401(self) -> None: + """Integration test for create_stream error path (HTTP 401)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.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_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_stream_error_412(self) -> None: + """Integration test for create_stream error path (HTTP 412)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "PRECONDITION_FAILED", + "errors" : [ "User cannot create more than 5 integrations", "User cannot create more than 5 integrations" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(412) + ) as context: + self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="412"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_stream_error_500(self) -> None: + """Integration test for create_stream error path (HTTP 500)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_stream_happy_path(self) -> None: + """Integration test for delete_stream success path""" + id = 'id_example' + aid = '1234' + response = self.api.delete_stream_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_stream"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_stream_error_401(self) -> None: + """Integration test for delete_stream error path (HTTP 401)""" + id = 'id_example' + 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.delete_stream( + id=id, + aid=aid, + _headers=self.te_headers("delete_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_stream_error_500(self) -> None: + """Integration test for delete_stream error path (HTTP 500)""" + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.delete_stream( + id=id, + aid=aid, + _headers=self.te_headers("delete_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_stream_happy_path(self) -> None: + """Integration test for get_stream success path""" + id = 'id_example' + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_stream( + id=id, + aid=aid, + type=type, + _headers=self.te_headers("get_stream"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_stream_error_401(self) -> None: + """Integration test for get_stream error path (HTTP 401)""" + id = 'id_example' + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + 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_stream( + id=id, + aid=aid, + type=type, + _headers=self.te_headers("get_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_stream_error_500(self) -> None: + """Integration test for get_stream error path (HTTP 500)""" + id = 'id_example' + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_stream( + id=id, + aid=aid, + type=type, + _headers=self.te_headers("get_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_streams_happy_path(self) -> None: + """Integration test for get_streams success path""" + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + response_body_json = """ + [ { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + }, { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } ] + """ + expected_response = json.loads(response_body_json) + response = self.api.get_streams( + aid=aid, + type=type, + _headers=self.te_headers("get_streams"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_streams_error_400(self) -> None: + """Integration test for get_streams error path (HTTP 400)""" + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_streams( + aid=aid, + type=type, + _headers=self.te_headers("get_streams", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_streams_error_401(self) -> None: + """Integration test for get_streams error path (HTTP 401)""" + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + 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_streams( + aid=aid, + type=type, + _headers=self.te_headers("get_streams", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_streams_error_500(self) -> None: + """Integration test for get_streams error path (HTTP 500)""" + aid = '1234' + type = thousandeyes_sdk.streaming.StreamType() + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_streams( + aid=aid, + type=type, + _headers=self.te_headers("get_streams", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_stream_happy_path(self) -> None: + """Integration test for update_stream success path""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_stream_error_400(self) -> None: + """Integration test for update_stream error path (HTTP 400)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_stream_error_401(self) -> None: + """Integration test for update_stream error path (HTTP 401)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + 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.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_stream_error_500(self) -> None: + """Integration test for update_stream error path (HTTP 500)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tags/test/conftest.py b/thousandeyes-sdk-tags/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-tags/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-tags/test/integration_test_utils.py b/thousandeyes-sdk-tags/test/integration_test_utils.py new file mode 100644 index 00000000..38df1ff2 --- /dev/null +++ b/thousandeyes-sdk-tags/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Tags API + + The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`. This feature provides: * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations. Things to note with the ThousandEyes Tags API: * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. + + 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 diff --git a/thousandeyes-sdk-tags/test/mock_manifest.py b/thousandeyes-sdk-tags/test/mock_manifest.py new file mode 100644 index 00000000..6d951851 --- /dev/null +++ b/thousandeyes-sdk-tags/test/mock_manifest.py @@ -0,0 +1,1774 @@ +# coding: utf-8 + +""" + Tags API + + The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`. This feature provides: * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations. Things to note with the ThousandEyes Tags API: * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. + + 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 = { + + "assign_tag": OperationExpectation( + operation_id="assign_tag", + method="POST", + path="/tags/{id}/assign", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=207, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """), + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_tags": OperationExpectation( + operation_id="assign_tags", + method="POST", + path="/tags/assign", + path_param_examples={ + }, + success_status=207, + 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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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=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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """), + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_tag": OperationExpectation( + operation_id="unassign_tag", + method="POST", + path="/tags/{id}/unassign", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """), + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_tags": OperationExpectation( + operation_id="unassign_tags", + method="POST", + path="/tags/unassign", + path_param_examples={ + }, + success_status=207, + 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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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=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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """), + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_tag": OperationExpectation( + operation_id="create_tag", + method="POST", + path="/tags", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_tags": OperationExpectation( + operation_id="create_tags", + method="POST", + path="/tags/bulk", + path_param_examples={ + }, + success_status=207, + 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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_tag": OperationExpectation( + operation_id="delete_tag", + method="DELETE", + path="/tags/{id}", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + 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" : 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tag": OperationExpectation( + operation_id="get_tag", + method="GET", + path="/tags/{id}", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=200, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tags": OperationExpectation( + operation_id="get_tags", + method="GET", + path="/tags", + 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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_tag": OperationExpectation( + operation_id="update_tag", + method="PUT", + path="/tags/{id}", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=200, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + 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(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py b/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py new file mode 100644 index 00000000..e01ffbb6 --- /dev/null +++ b/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py @@ -0,0 +1,1633 @@ +# coding: utf-8 + +""" + Tags API + + The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`. This feature provides: * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations. Things to note with the ThousandEyes Tags API: * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tags.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tags.api.tag_assignment_api import TagAssignmentApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestTagAssignmentApiIntegration(IntegrationTestBase): + """TagAssignmentApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = TagAssignmentApi(self.api_client) + + + def test_assign_tag_happy_path(self) -> None: + """Integration test for assign_tag success path""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + response_body_json = """ + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_assign_tag_error_401(self) -> None: + """Integration test for assign_tag error path (HTTP 401)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tag_error_403(self) -> None: + """Integration test for assign_tag error path (HTTP 403)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tag_error_404(self) -> None: + """Integration test for assign_tag error path (HTTP 404)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tag_error_429(self) -> None: + """Integration test for assign_tag error path (HTTP 429)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tag_error_500(self) -> None: + """Integration test for assign_tag error path (HTTP 500)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_assign_tags_happy_path(self) -> None: + """Integration test for assign_tags success path""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json) + 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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_assign_tags_error_401(self) -> None: + """Integration test for assign_tags error path (HTTP 401)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tags_error_403(self) -> None: + """Integration test for assign_tags error path (HTTP 403)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tags_error_404(self) -> None: + """Integration test for assign_tags error path (HTTP 404)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tags_error_429(self) -> None: + """Integration test for assign_tags error path (HTTP 429)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_tags_error_500(self) -> None: + """Integration test for assign_tags error path (HTTP 500)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_unassign_tag_happy_path(self) -> None: + """Integration test for unassign_tag success path""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + response = self.api.unassign_tag_with_http_info( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_unassign_tag_error_401(self) -> None: + """Integration test for unassign_tag error path (HTTP 401)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tag_error_403(self) -> None: + """Integration test for unassign_tag error path (HTTP 403)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tag_error_404(self) -> None: + """Integration test for unassign_tag error path (HTTP 404)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tag_error_429(self) -> None: + """Integration test for unassign_tag error path (HTTP 429)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tag_error_500(self) -> None: + """Integration test for unassign_tag error path (HTTP 500)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """ + tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_unassign_tags_happy_path(self) -> None: + """Integration test for unassign_tags success path""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json) + 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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_unassign_tags_error_401(self) -> None: + """Integration test for unassign_tags error path (HTTP 401)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tags_error_403(self) -> None: + """Integration test for unassign_tags error path (HTTP 403)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tags_error_404(self) -> None: + """Integration test for unassign_tags error path (HTTP 404)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tags_error_429(self) -> None: + """Integration test for unassign_tags error path (HTTP 429)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_tags_error_500(self) -> None: + """Integration test for unassign_tags error path (HTTP 500)""" + request_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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" + } + } + } ] + } + + """ + bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tags/test/test_tags_api_integration.py b/thousandeyes-sdk-tags/test/test_tags_api_integration.py new file mode 100644 index 00000000..39cbe039 --- /dev/null +++ b/thousandeyes-sdk-tags/test/test_tags_api_integration.py @@ -0,0 +1,2397 @@ +# coding: utf-8 + +""" + Tags API + + The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`. This feature provides: * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations. Things to note with the ThousandEyes Tags API: * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tags.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tags.api.tags_api import TagsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestTagsApiIntegration(IntegrationTestBase): + """TagsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = TagsApi(self.api_client) + + + def test_create_tag_happy_path(self) -> None: + """Integration test for create_tag success path""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_tag_error_400(self) -> None: + """Integration test for create_tag error path (HTTP 400)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.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_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_tag_error_401(self) -> None: + """Integration test for create_tag error path (HTTP 401)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.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_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_tag_error_500(self) -> None: + """Integration test for create_tag error path (HTTP 500)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.create_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_create_tags_happy_path(self) -> None: + """Integration test for create_tags success path""" + request_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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """ + bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.from_json(request_body_json) + 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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_tags_error_400(self) -> None: + """Integration test for create_tags error path (HTTP 400)""" + request_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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """ + bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.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_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_tags_error_401(self) -> None: + """Integration test for create_tags error path (HTTP 401)""" + request_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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """ + bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.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_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_tags_error_500(self) -> None: + """Integration test for create_tags error path (HTTP 500)""" + request_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" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """ + bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.create_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_tag_happy_path(self) -> None: + """Integration test for delete_tag success path""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + response = self.api.delete_tag_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_tag_error_401(self) -> None: + """Integration test for delete_tag error path (HTTP 401)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_tag_error_403(self) -> None: + """Integration test for delete_tag error path (HTTP 403)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_tag_error_404(self) -> None: + """Integration test for delete_tag error path (HTTP 404)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_tag_error_429(self) -> None: + """Integration test for delete_tag error path (HTTP 429)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_tag_error_500(self) -> None: + """Integration test for delete_tag error path (HTTP 500)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_tag_happy_path(self) -> None: + """Integration test for get_tag success path""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + response_body_json = """ + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_tag( + id=id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_tag"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_tag_error_401(self) -> None: + """Integration test for get_tag error path (HTTP 401)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tag( + id=id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_tag", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tag_error_403(self) -> None: + """Integration test for get_tag error path (HTTP 403)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tag( + id=id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_tag", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tag_error_404(self) -> None: + """Integration test for get_tag error path (HTTP 404)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tag( + id=id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_tag", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tag_error_429(self) -> None: + """Integration test for get_tag error path (HTTP 429)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tag( + id=id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_tag", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tag_error_500(self) -> None: + """Integration test for get_tag error path (HTTP 500)""" + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_tag( + id=id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_tag", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_tags_happy_path(self) -> None: + """Integration test for get_tags success path""" + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_tags( + aid=aid, + expand=expand, + _headers=self.te_headers("get_tags"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_tags_error_401(self) -> None: + """Integration test for get_tags error path (HTTP 401)""" + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tags( + aid=aid, + expand=expand, + _headers=self.te_headers("get_tags", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tags_error_403(self) -> None: + """Integration test for get_tags error path (HTTP 403)""" + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tags( + aid=aid, + expand=expand, + _headers=self.te_headers("get_tags", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tags_error_404(self) -> None: + """Integration test for get_tags error path (HTTP 404)""" + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tags( + aid=aid, + expand=expand, + _headers=self.te_headers("get_tags", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tags_error_429(self) -> None: + """Integration test for get_tags error path (HTTP 429)""" + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + 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_tags( + aid=aid, + expand=expand, + _headers=self.te_headers("get_tags", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tags_error_500(self) -> None: + """Integration test for get_tags error path (HTTP 500)""" + aid = '1234' + expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_tags( + aid=aid, + expand=expand, + _headers=self.te_headers("get_tags", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_tag_happy_path(self) -> None: + """Integration test for update_tag success path""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + response_body_json = """ + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_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", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_tag_error_401(self) -> None: + """Integration test for update_tag error path (HTTP 401)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_tag_error_403(self) -> None: + """Integration test for update_tag error path (HTTP 403)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_tag_error_404(self) -> None: + """Integration test for update_tag error path (HTTP 404)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_tag_error_429(self) -> None: + """Integration test for update_tag error path (HTTP 429)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + 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.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_tag_error_500(self) -> None: + """Integration test for update_tag error path (HTTP 500)""" + request_body_json = """ + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """ + tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json) + id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/conftest.py b/thousandeyes-sdk-test-results/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-test-results/test/integration_test_utils.py b/thousandeyes-sdk-test-results/test/integration_test_utils.py new file mode 100644 index 00000000..27d6ab3a --- /dev/null +++ b/thousandeyes-sdk-test-results/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + 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 diff --git a/thousandeyes-sdk-test-results/test/mock_manifest.py b/thousandeyes-sdk-test-results/test/mock_manifest.py new file mode 100644 index 00000000..1317b5e7 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/mock_manifest.py @@ -0,0 +1,6272 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + 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_test_api_agent_round_results": OperationExpectation( + operation_id="get_test_api_agent_round_results", + method="GET", + path="/test-results/{testId}/api/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + }, { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + }, { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_test_api_results": OperationExpectation( + operation_id="get_test_api_results", + method="GET", + path="/test-results/{testId}/api", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_dns_sec_results": OperationExpectation( + operation_id="get_test_dns_sec_results", + method="GET", + path="/test-results/{testId}/dnssec", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_dns_server_result": OperationExpectation( + operation_id="get_test_dns_server_result", + method="GET", + path="/test-results/{testId}/dns-server/{serverId}", + path_param_examples={ + "testId": '202701', + "serverId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_dns_servers_results": OperationExpectation( + operation_id="get_test_dns_servers_results", + method="GET", + path="/test-results/{testId}/dns-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_dns_trace_results": OperationExpectation( + operation_id="get_test_dns_trace_results", + method="GET", + path="/test-results/{testId}/dns-trace", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_bgp_results": OperationExpectation( + operation_id="get_test_bgp_results", + method="GET", + path="/test-results/{testId}/bgp", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" + }, { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_bgp_routes_prefix_round_results": OperationExpectation( + operation_id="get_test_bgp_routes_prefix_round_results", + method="GET", + path="/test-results/{testId}/bgp/routes/prefix/{prefixId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "prefixId": '3789376546', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 + }, { + "asName" : "Telus Advanced Communications", + "asn" : 852 + } ], + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" + }, { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 + }, { + "asName" : "Telus Advanced Communications", + "asn" : 852 + } ], + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_test_network_results": OperationExpectation( + operation_id="get_test_network_results", + method="GET", + path="/test-results/{testId}/network", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_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" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_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" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_path_vis_agent_round_results": OperationExpectation( + operation_id="get_test_path_vis_agent_round_results", + method="GET", + path="/test-results/{testId}/path-vis/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + }, { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + }, { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_test_path_vis_results": OperationExpectation( + operation_id="get_test_path_vis_results", + method="GET", + path="/test-results/{testId}/path-vis", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + }, { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + }, { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_rtp_server_results": OperationExpectation( + operation_id="get_test_rtp_server_results", + method="GET", + path="/test-results/{testId}/rtp-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pdv" : 1, + "_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" + } + }, + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pdv" : 1, + "_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" + } + }, + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_sip_server_results": OperationExpectation( + operation_id="get_test_sip_server_results", + method="GET", + path="/test-results/{testId}/sip-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: \\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: \\r\\nAuthorization: Digest username=\\"al6054\\", realm=\\"asterisk\\", nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\", uri=\\"sip:6054@voice.sfo2.notarealco.com\\", response=\\"83c538a39ff766cf75ffd1d62317b442\\", algorithm=MD5, cnonce=\\"0a4f113b\\", opaque=\\"748ffa241d840721\\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\\"asterisk\\",nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\",opaque=\\"748ffa241d840721\\",algorithm=md5,qop=\\"auth\\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: \\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: \\r\\nAuthorization: Digest username=\\"al6054\\", realm=\\"asterisk\\", nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\", uri=\\"sip:6054@voice.sfo2.notarealco.com\\", response=\\"83c538a39ff766cf75ffd1d62317b442\\", algorithm=MD5, cnonce=\\"0a4f113b\\", opaque=\\"748ffa241d840721\\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\\"asterisk\\",nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\",opaque=\\"748ffa241d840721\\",algorithm=md5,qop=\\"auth\\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_ftp_server_results": OperationExpectation( + operation_id="get_test_ftp_server_results", + method="GET", + path="/test-results/{testId}/ftp-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "transferTime" : 99.865, + "_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" + } + }, + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "transferTime" : 99.865, + "_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" + } + }, + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_http_server_results": OperationExpectation( + operation_id="get_test_http_server_results", + method="GET", + path="/test-results/{testId}/http-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "sslVersion" : "TLSv1.3", + "_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" + } + }, + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + }, { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + } ], + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" + } ], + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 + }, + "protocol" : "udp" + }, + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 + }, + "protocol" : "udp" + } ], + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" + }, + "wireSize" : 9993, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "sslVersion" : "TLSv1.3", + "_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" + } + }, + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + }, { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + } ], + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" + } ], + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 + }, + "protocol" : "udp" + }, + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 + }, + "protocol" : "udp" + } ], + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" + }, + "wireSize" : 9993, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_page_load_agent_round_results": OperationExpectation( + operation_id="get_test_page_load_agent_round_results", + method="GET", + path="/test-results/{testId}/page-load/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_test_page_load_results": OperationExpectation( + operation_id="get_test_page_load_results", + method="GET", + path="/test-results/{testId}/page-load", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "totalSize" : 403301, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "totalSize" : 403301, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + + "get_test_web_transaction_agent_round_page_results": OperationExpectation( + operation_id="get_test_web_transaction_agent_round_page_results", + method="GET", + path="/test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/page/{pageId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + "pageId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_test_web_transaction_agent_round_results": OperationExpectation( + operation_id="get_test_web_transaction_agent_round_results", + method="GET", + path="/test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_test_web_transaction_results": OperationExpectation( + operation_id="get_test_web_transaction_results", + method="GET", + path="/test-results/{testId}/web-transactions", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py new file mode 100644 index 00000000..980d4167 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py @@ -0,0 +1,869 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.api_test_results_api import APITestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAPITestResultsApiIntegration(IntegrationTestBase): + """APITestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = APITestResultsApi(self.api_client) + + + def test_get_test_api_agent_round_results_happy_path(self) -> None: + """Integration test for get_test_api_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + }, { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + }, { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_api_agent_round_results_error_400(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_agent_round_results_error_401(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_agent_round_results_error_403(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_agent_round_results_error_404(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_agent_round_results_error_429(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_agent_round_results_error_500(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_agent_round_results_error_502(self) -> None: + """Integration test for get_test_api_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_api_results_happy_path(self) -> None: + """Integration test for get_test_api_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_api_results_error_400(self) -> None: + """Integration test for get_test_api_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_results_error_401(self) -> None: + """Integration test for get_test_api_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_results_error_403(self) -> None: + """Integration test for get_test_api_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_results_error_404(self) -> None: + """Integration test for get_test_api_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_results_error_429(self) -> None: + """Integration test for get_test_api_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_results_error_500(self) -> None: + """Integration test for get_test_api_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_api_results_error_502(self) -> None: + """Integration test for get_test_api_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py new file mode 100644 index 00000000..09c183f8 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py @@ -0,0 +1,825 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.dns_server_test_results_api import DNSServerTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): + """DNSServerTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DNSServerTestResultsApi(self.api_client) + + + def test_get_test_dns_server_result_happy_path(self) -> None: + """Integration test for get_test_dns_server_result success path""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_dns_server_result_error_400(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 400)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_server_result_error_401(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 401)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_server_result_error_403(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 403)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_server_result_error_404(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 404)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_server_result_error_429(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 429)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_server_result_error_500(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 500)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_server_result_error_502(self) -> None: + """Integration test for get_test_dns_server_result error path (HTTP 502)""" + test_id = '202701' + server_id = '281474976710706' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_dns_servers_results_happy_path(self) -> None: + """Integration test for get_test_dns_servers_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_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" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_dns_servers_results_error_400(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_servers_results_error_401(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_servers_results_error_403(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_servers_results_error_404(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_servers_results_error_429(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_servers_results_error_500(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_servers_results_error_502(self) -> None: + """Integration test for get_test_dns_servers_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py new file mode 100644 index 00000000..5301c030 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py @@ -0,0 +1,426 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.dns_trace_test_results_api import DNSTraceTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): + """DNSTraceTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DNSTraceTestResultsApi(self.api_client) + + + def test_get_test_dns_trace_results_happy_path(self) -> None: + """Integration test for get_test_dns_trace_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_dns_trace_results_error_400(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_trace_results_error_401(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_trace_results_error_403(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_trace_results_error_404(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_trace_results_error_429(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_trace_results_error_500(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_trace_results_error_502(self) -> None: + """Integration test for get_test_dns_trace_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py new file mode 100644 index 00000000..34183ffb --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py @@ -0,0 +1,416 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.dnssec_test_results_api import DNSSECTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): + """DNSSECTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DNSSECTestResultsApi(self.api_client) + + + def test_get_test_dns_sec_results_happy_path(self) -> None: + """Integration test for get_test_dns_sec_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_dns_sec_results_error_400(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_sec_results_error_401(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_sec_results_error_403(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_sec_results_error_404(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_sec_results_error_429(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_sec_results_error_500(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_dns_sec_results_error_502(self) -> None: + """Integration test for get_test_dns_sec_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py new file mode 100644 index 00000000..070314ed --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py @@ -0,0 +1,757 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.network_bgp_test_results_api import NetworkBGPTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): + """NetworkBGPTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = NetworkBGPTestResultsApi(self.api_client) + + + def test_get_test_bgp_results_happy_path(self) -> None: + """Integration test for get_test_bgp_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" + }, { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_bgp_results_error_400(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_results_error_401(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_results_error_403(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_results_error_404(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_results_error_429(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_results_error_500(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_results_error_502(self) -> None: + """Integration test for get_test_bgp_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_bgp_routes_prefix_round_results_happy_path(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results success path""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 + }, { + "asName" : "Telus Advanced Communications", + "asn" : 852 + } ], + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" + }, { + "date" : "2022-07-17T22: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" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 + }, { + "asName" : "Telus Advanced Communications", + "asn" : 852 + } ], + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_bgp_routes_prefix_round_results_error_400(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 400)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_routes_prefix_round_results_error_401(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 401)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_routes_prefix_round_results_error_403(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 403)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_routes_prefix_round_results_error_404(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 404)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_routes_prefix_round_results_error_429(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 429)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_routes_prefix_round_results_error_500(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 500)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_bgp_routes_prefix_round_results_error_502(self) -> None: + """Integration test for get_test_bgp_routes_prefix_round_results error path (HTTP 502)""" + test_id = '202701' + prefix_id = '3789376546' + round_id = '1384309800' + 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_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py new file mode 100644 index 00000000..7134c5d1 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py @@ -0,0 +1,1336 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.network_test_results_api import NetworkTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestNetworkTestResultsApiIntegration(IntegrationTestBase): + """NetworkTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = NetworkTestResultsApi(self.api_client) + + + def test_get_test_network_results_happy_path(self) -> None: + """Integration test for get_test_network_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_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" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_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" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_network_results_error_400(self) -> None: + """Integration test for get_test_network_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_network_results_error_401(self) -> None: + """Integration test for get_test_network_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_network_results_error_403(self) -> None: + """Integration test for get_test_network_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_network_results_error_404(self) -> None: + """Integration test for get_test_network_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_network_results_error_429(self) -> None: + """Integration test for get_test_network_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_network_results_error_500(self) -> None: + """Integration test for get_test_network_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_network_results_error_502(self) -> None: + """Integration test for get_test_network_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.TestDirection() + 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_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_path_vis_agent_round_results_happy_path(self) -> None: + """Integration test for get_test_path_vis_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + response_body_json = """ + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + }, { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + }, { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_path_vis_agent_round_results_error_400(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_agent_round_results_error_401(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_agent_round_results_error_403(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_agent_round_results_error_404(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_agent_round_results_error_429(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_agent_round_results_error_500(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_agent_round_results_error_502(self) -> None: + """Integration test for get_test_path_vis_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_path_vis_results_happy_path(self) -> None: + """Integration test for get_test_path_vis_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + }, { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + }, { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_path_vis_results_error_400(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_results_error_401(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_results_error_403(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_results_error_404(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_results_error_429(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_results_error_500(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_path_vis_results_error_502(self) -> None: + """Integration test for get_test_path_vis_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + direction = thousandeyes_sdk.test_results.PathVisDirection() + 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_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py new file mode 100644 index 00000000..29f3c0a4 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py @@ -0,0 +1,434 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.voice_rtp_server_test_results_api import VoiceRTPServerTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): + """VoiceRTPServerTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = VoiceRTPServerTestResultsApi(self.api_client) + + + def test_get_test_rtp_server_results_happy_path(self) -> None: + """Integration test for get_test_rtp_server_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pdv" : 1, + "_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" + } + }, + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pdv" : 1, + "_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" + } + }, + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_rtp_server_results_error_400(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_rtp_server_results_error_401(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_rtp_server_results_error_403(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_rtp_server_results_error_404(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_rtp_server_results_error_429(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_rtp_server_results_error_500(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_rtp_server_results_error_502(self) -> None: + """Integration test for get_test_rtp_server_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py new file mode 100644 index 00000000..fffe6ecd --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py @@ -0,0 +1,444 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.voice_sip_server_test_results_api import VoiceSIPServerTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): + """VoiceSIPServerTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = VoiceSIPServerTestResultsApi(self.api_client) + + + def test_get_test_sip_server_results_happy_path(self) -> None: + """Integration test for get_test_sip_server_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nAuthorization: Digest username=\"al6054\", realm=\"asterisk\", nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\", uri=\"sip:6054@voice.sfo2.notarealco.com\", response=\"83c538a39ff766cf75ffd1d62317b442\", algorithm=MD5, cnonce=\"0a4f113b\", opaque=\"748ffa241d840721\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\"asterisk\",nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\",opaque=\"748ffa241d840721\",algorithm=md5,qop=\"auth\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nAuthorization: Digest username=\"al6054\", realm=\"asterisk\", nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\", uri=\"sip:6054@voice.sfo2.notarealco.com\", response=\"83c538a39ff766cf75ffd1d62317b442\", algorithm=MD5, cnonce=\"0a4f113b\", opaque=\"748ffa241d840721\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\"asterisk\",nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\",opaque=\"748ffa241d840721\",algorithm=md5,qop=\"auth\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_sip_server_results_error_400(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_sip_server_results_error_401(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_sip_server_results_error_403(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_sip_server_results_error_404(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_sip_server_results_error_429(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_sip_server_results_error_500(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_sip_server_results_error_502(self) -> None: + """Integration test for get_test_sip_server_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py new file mode 100644 index 00000000..2a744c34 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py @@ -0,0 +1,438 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.web_ftp_server_test_results_api import WebFTPServerTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): + """WebFTPServerTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebFTPServerTestResultsApi(self.api_client) + + + def test_get_test_ftp_server_results_happy_path(self) -> None: + """Integration test for get_test_ftp_server_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "transferTime" : 99.865, + "_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" + } + }, + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "transferTime" : 99.865, + "_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" + } + }, + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_ftp_server_results_error_400(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_ftp_server_results_error_401(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_ftp_server_results_error_403(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_ftp_server_results_error_404(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_ftp_server_results_error_429(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_ftp_server_results_error_500(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_ftp_server_results_error_502(self) -> None: + """Integration test for get_test_ftp_server_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py new file mode 100644 index 00000000..bf5d5e01 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py @@ -0,0 +1,636 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.web_http_server_test_results_api import WebHTTPServerTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): + """WebHTTPServerTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebHTTPServerTestResultsApi(self.api_client) + + + def test_get_test_http_server_results_happy_path(self) -> None: + """Integration test for get_test_http_server_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "sslVersion" : "TLSv1.3", + "_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" + } + }, + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + }, { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + } ], + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" + } ], + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 + }, + "protocol" : "udp" + }, + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 + }, + "protocol" : "udp" + } ], + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" + }, + "wireSize" : 9993, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "sslVersion" : "TLSv1.3", + "_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" + } + }, + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + }, { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + } ], + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" + } ], + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 + }, + "protocol" : "udp" + }, + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 + }, + "protocol" : "udp" + } ], + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" + }, + "wireSize" : 9993, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_http_server_results_error_400(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_http_server_results_error_401(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_http_server_results_error_403(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_http_server_results_error_404(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_http_server_results_error_429(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_http_server_results_error_500(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_http_server_results_error_502(self) -> None: + """Integration test for get_test_http_server_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + expand = [thousandeyes_sdk.test_results.Expand()] + 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_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py new file mode 100644 index 00000000..72edc963 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py @@ -0,0 +1,1211 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.web_page_load_test_results_api import WebPageLoadTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): + """WebPageLoadTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebPageLoadTestResultsApi(self.api_client) + + + def test_get_test_page_load_agent_round_results_happy_path(self) -> None: + """Integration test for get_test_page_load_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_page_load_agent_round_results_error_400(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_agent_round_results_error_401(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_agent_round_results_error_403(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_agent_round_results_error_404(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_agent_round_results_error_429(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_agent_round_results_error_500(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_agent_round_results_error_502(self) -> None: + """Integration test for get_test_page_load_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_page_load_results_happy_path(self) -> None: + """Integration test for get_test_page_load_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "totalSize" : 403301, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "totalSize" : 403301, + "numErrors" : 0, + "_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" + } + }, + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_page_load_results_error_400(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_results_error_401(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_results_error_403(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_results_error_404(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_results_error_429(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_results_error_500(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_page_load_results_error_502(self) -> None: + """Integration test for get_test_page_load_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py new file mode 100644 index 00000000..dd9be272 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py @@ -0,0 +1,1650 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.web_transactions_test_results_api import WebTransactionsTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): + """WebTransactionsTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebTransactionsTestResultsApi(self.api_client) + + + def test_get_test_web_transaction_agent_round_page_results_happy_path(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + response_body_json = """ + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_web_transaction_agent_round_page_results_error_400(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + 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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_401(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_403(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + 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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_404(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + 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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_429(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + 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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_500(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + 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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_502(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + 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_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_web_transaction_agent_round_results_happy_path(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "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" + }, + "_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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_web_transaction_agent_round_results_error_400(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_401(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_403(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_404(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_429(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_500(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_502(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + 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_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_web_transaction_results_happy_path(self) -> None: + """Integration test for get_test_web_transaction_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "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" + }, + "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" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_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" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_web_transaction_results_error_400(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + 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_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_401(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + 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_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_403(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + 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_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_404(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + 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_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_429(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + 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_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_500(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + 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_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_502(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + 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(502) + ) as context: + self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/conftest.py b/thousandeyes-sdk-tests/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-tests/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-tests/test/integration_test_utils.py b/thousandeyes-sdk-tests/test/integration_test_utils.py new file mode 100644 index 00000000..3375a6fd --- /dev/null +++ b/thousandeyes-sdk-tests/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + 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 diff --git a/thousandeyes-sdk-tests/test/mock_manifest.py b/thousandeyes-sdk-tests/test/mock_manifest.py new file mode 100644 index 00000000..c9bad0bb --- /dev/null +++ b/thousandeyes-sdk-tests/test/mock_manifest.py @@ -0,0 +1,18313 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + 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_api_test": OperationExpectation( + operation_id="create_api_test", + method="POST", + path="/tests/api", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_api_test": OperationExpectation( + operation_id="delete_api_test", + method="DELETE", + path="/tests/api/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_api_test": OperationExpectation( + operation_id="get_api_test", + method="GET", + path="/tests/api/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_api_tests": OperationExpectation( + operation_id="get_api_tests", + method="GET", + path="/tests/api", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_api_test": OperationExpectation( + operation_id="update_api_test", + method="PUT", + path="/tests/api/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_agent_test": OperationExpectation( + operation_id="create_agent_to_agent_test", + method="POST", + path="/tests/agent-to-agent", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_agent_test": OperationExpectation( + operation_id="delete_agent_to_agent_test", + method="DELETE", + path="/tests/agent-to-agent/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_agent_test": OperationExpectation( + operation_id="get_agent_to_agent_test", + method="GET", + path="/tests/agent-to-agent/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_agent_tests": OperationExpectation( + operation_id="get_agent_to_agent_tests", + method="GET", + path="/tests/agent-to-agent", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + }, + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" + }, { + "_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, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_agent_test": OperationExpectation( + operation_id="update_agent_to_agent_test", + method="PUT", + path="/tests/agent-to-agent/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_server_test": OperationExpectation( + operation_id="create_agent_to_server_test", + method="POST", + path="/tests/agent-to-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_server_test": OperationExpectation( + operation_id="delete_agent_to_server_test", + method="DELETE", + path="/tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_test": OperationExpectation( + operation_id="get_agent_to_server_test", + method="GET", + path="/tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_tests": OperationExpectation( + operation_id="get_agent_to_server_tests", + method="GET", + path="/tests/agent-to-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_server_test": OperationExpectation( + operation_id="update_agent_to_server_test", + method="PUT", + path="/tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_bgp_test": OperationExpectation( + operation_id="create_bgp_test", + method="POST", + path="/tests/bgp", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : 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" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_bgp_test": OperationExpectation( + operation_id="delete_bgp_test", + method="DELETE", + path="/tests/bgp/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_bgp_test": OperationExpectation( + operation_id="get_bgp_test", + method="GET", + path="/tests/bgp/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : 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" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_bgp_tests": OperationExpectation( + operation_id="get_bgp_tests", + method="GET", + path="/tests/bgp", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_bgp_test": OperationExpectation( + operation_id="update_bgp_test", + method="PUT", + path="/tests/bgp/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : 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" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_sec_test": OperationExpectation( + operation_id="create_dns_sec_test", + method="POST", + path="/tests/dnssec", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dns_sec_test": OperationExpectation( + operation_id="delete_dns_sec_test", + method="DELETE", + path="/tests/dnssec/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_sec_test": OperationExpectation( + operation_id="get_dns_sec_test", + method="GET", + path="/tests/dnssec/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_sec_tests": OperationExpectation( + operation_id="get_dns_sec_tests", + method="GET", + path="/tests/dnssec", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dns_sec_test": OperationExpectation( + operation_id="update_dns_sec_test", + method="PUT", + path="/tests/dnssec/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_server_test": OperationExpectation( + operation_id="create_dns_server_test", + method="POST", + path="/tests/dns-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dns_server_test": OperationExpectation( + operation_id="delete_dns_server_test", + method="DELETE", + path="/tests/dns-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_server_test": OperationExpectation( + operation_id="get_dns_server_test", + method="GET", + path="/tests/dns-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_server_tests": OperationExpectation( + operation_id="get_dns_server_tests", + method="GET", + path="/tests/dns-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dns_server_test": OperationExpectation( + operation_id="update_dns_server_test", + method="PUT", + path="/tests/dns-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_trace_test": OperationExpectation( + operation_id="create_dns_trace_test", + method="POST", + path="/tests/dns-trace", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dns_trace_test": OperationExpectation( + operation_id="delete_dns_trace_test", + method="DELETE", + path="/tests/dns-trace/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_trace_test": OperationExpectation( + operation_id="get_dns_trace_test", + method="GET", + path="/tests/dns-trace/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_trace_tests": OperationExpectation( + operation_id="get_dns_trace_tests", + method="GET", + path="/tests/dns-trace", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dns_trace_test": OperationExpectation( + operation_id="update_dns_trace_test", + method="PUT", + path="/tests/dns-trace/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_ftp_server_test": OperationExpectation( + operation_id="create_ftp_server_test", + method="POST", + path="/tests/ftp-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_ftp_server_test": OperationExpectation( + operation_id="delete_ftp_server_test", + method="DELETE", + path="/tests/ftp-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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_ftp_server_test": OperationExpectation( + operation_id="get_ftp_server_test", + method="GET", + path="/tests/ftp-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_ftp_server_tests": OperationExpectation( + operation_id="get_ftp_server_tests", + method="GET", + path="/tests/ftp-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_ftp_server_test": OperationExpectation( + operation_id="update_ftp_server_test", + method="PUT", + path="/tests/ftp-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_test": OperationExpectation( + operation_id="create_http_server_test", + method="POST", + path="/tests/http-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_http_server_test": OperationExpectation( + operation_id="delete_http_server_test", + method="DELETE", + path="/tests/http-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_test": OperationExpectation( + operation_id="get_http_server_test", + method="GET", + path="/tests/http-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_tests": OperationExpectation( + operation_id="get_http_server_tests", + method="GET", + path="/tests/http-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_http_server_test": OperationExpectation( + operation_id="update_http_server_test", + method="PUT", + path="/tests/http-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_page_load_test": OperationExpectation( + operation_id="create_page_load_test", + method="POST", + path="/tests/page-load", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_page_load_test": OperationExpectation( + operation_id="delete_page_load_test", + method="DELETE", + path="/tests/page-load/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_page_load_test": OperationExpectation( + operation_id="get_page_load_test", + method="GET", + path="/tests/page-load/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_page_load_tests": OperationExpectation( + operation_id="get_page_load_tests", + method="GET", + path="/tests/page-load", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_page_load_test": OperationExpectation( + operation_id="update_page_load_test", + method="PUT", + path="/tests/page-load/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_path_vis_interface_groups": OperationExpectation( + operation_id="create_path_vis_interface_groups", + method="POST", + path="/network/path-vis/interface-groups", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_path_vis_interface_group": OperationExpectation( + operation_id="delete_path_vis_interface_group", + method="DELETE", + path="/network/path-vis/interface-groups/{interfaceGroupId}", + path_param_examples={ + "interfaceGroupId": '281474976710706', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_path_vis_interface_groups": OperationExpectation( + operation_id="get_path_vis_interface_groups", + method="GET", + path="/network/path-vis/interface-groups", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "pathVisInterfaceGroups" : [ { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + }, { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_path_vis_interface_group": OperationExpectation( + operation_id="update_path_vis_interface_group", + method="PUT", + path="/network/path-vis/interface-groups/{interfaceGroupId}", + path_param_examples={ + "interfaceGroupId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_sip_server_test": OperationExpectation( + operation_id="create_sip_server_test", + method="POST", + path="/tests/sip-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_sip_server_test": OperationExpectation( + operation_id="delete_sip_server_test", + method="DELETE", + path="/tests/sip-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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_sip_server_test": OperationExpectation( + operation_id="get_sip_server_test", + method="GET", + path="/tests/sip-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_sip_server_tests": OperationExpectation( + operation_id="get_sip_server_tests", + method="GET", + path="/tests/sip-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_sip_server_test": OperationExpectation( + operation_id="update_sip_server_test", + method="PUT", + path="/tests/sip-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_version_history": OperationExpectation( + operation_id="get_test_version_history", + method="GET", + path="/tests/{testId}/history", + path_param_examples={ + "testId": '202701', + }, + 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" + } + }, + "testVersionHistory" : [ { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" + }, { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" + } ] + } + + """), + + 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", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tests": OperationExpectation( + operation_id="get_tests", + method="GET", + path="/tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_voice_test": OperationExpectation( + operation_id="create_voice_test", + method="POST", + path="/tests/voice", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_voice_test": OperationExpectation( + operation_id="delete_voice_test", + method="DELETE", + path="/tests/voice/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_voice_test": OperationExpectation( + operation_id="get_voice_test", + method="GET", + path="/tests/voice/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_voice_tests": OperationExpectation( + operation_id="get_voice_tests", + method="GET", + path="/tests/voice", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "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" + } + }, + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : 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", + "interval" : 60, + "testId" : "281474976710706" + }, { + "_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", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : 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", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_voice_test": OperationExpectation( + operation_id="update_voice_test", + method="PUT", + path="/tests/voice/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_web_transactions_test": OperationExpectation( + operation_id="create_web_transactions_test", + method="POST", + path="/tests/web-transactions", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_web_transactions_test": OperationExpectation( + operation_id="delete_web_transactions_test", + method="DELETE", + path="/tests/web-transactions/{testId}", + path_param_examples={ + "testId": '202701', + }, + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_web_transactions_test": OperationExpectation( + operation_id="get_web_transactions_test", + method="GET", + path="/tests/web-transactions/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_web_transactions_tests": OperationExpectation( + operation_id="get_web_transactions_tests", + method="GET", + path="/tests/web-transactions", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } ], + "_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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_web_transactions_test": OperationExpectation( + operation_id="update_web_transactions_test", + method="PUT", + path="/tests/web-transactions/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + 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", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py new file mode 100644 index 00000000..7a1bbfe7 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py @@ -0,0 +1,2596 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.agent_to_agent_tests_api import AgentToAgentTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): + """AgentToAgentTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AgentToAgentTestsApi(self.api_client) + + + def test_create_agent_to_agent_test_happy_path(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_agent_to_agent_test_error_400(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_agent_test_error_401(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_agent_test_error_403(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_agent_test_error_404(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_agent_test_error_429(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_agent_test_error_500(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_agent_test_error_502(self) -> None: + """Integration test for create_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_agent_to_agent_test_happy_path(self) -> None: + """Integration test for delete_agent_to_agent_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_agent_to_agent_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_agent_to_agent_test_error_401(self) -> None: + """Integration test for delete_agent_to_agent_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_agent_test_error_403(self) -> None: + """Integration test for delete_agent_to_agent_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_agent_test_error_404(self) -> None: + """Integration test for delete_agent_to_agent_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_agent_test_error_429(self) -> None: + """Integration test for delete_agent_to_agent_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_agent_test_error_500(self) -> None: + """Integration test for delete_agent_to_agent_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_agent_test_error_502(self) -> None: + """Integration test for delete_agent_to_agent_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_agent_test_happy_path(self) -> None: + """Integration test for get_agent_to_agent_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_agent_test_error_401(self) -> None: + """Integration test for get_agent_to_agent_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_test_error_403(self) -> None: + """Integration test for get_agent_to_agent_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_test_error_404(self) -> None: + """Integration test for get_agent_to_agent_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_test_error_429(self) -> None: + """Integration test for get_agent_to_agent_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_test_error_500(self) -> None: + """Integration test for get_agent_to_agent_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_test_error_502(self) -> None: + """Integration test for get_agent_to_agent_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_agent_tests_happy_path(self) -> None: + """Integration test for get_agent_to_agent_tests success path""" + aid = '1234' + response_body_json = """ + { + "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" + } + }, + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" + }, { + "_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, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_agent_tests_error_401(self) -> None: + """Integration test for get_agent_to_agent_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_tests_error_403(self) -> None: + """Integration test for get_agent_to_agent_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_tests_error_404(self) -> None: + """Integration test for get_agent_to_agent_tests 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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_tests_error_429(self) -> None: + """Integration test for get_agent_to_agent_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_tests_error_500(self) -> None: + """Integration test for get_agent_to_agent_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_agent_tests_error_502(self) -> None: + """Integration test for get_agent_to_agent_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_agent_to_agent_test_happy_path(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_agent_to_agent_test_error_400(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_agent_test_error_401(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_agent_test_error_403(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_agent_test_error_404(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_agent_test_error_429(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_agent_test_error_500(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_agent_test_error_502(self) -> None: + """Integration test for update_agent_to_agent_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py new file mode 100644 index 00000000..c771830a --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py @@ -0,0 +1,2433 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.agent_to_server_tests_api import AgentToServerTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAgentToServerTestsApiIntegration(IntegrationTestBase): + """AgentToServerTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = AgentToServerTestsApi(self.api_client) + + + def test_create_agent_to_server_test_happy_path(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_agent_to_server_test_error_400(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_test_error_401(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_test_error_403(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_test_error_404(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_test_error_429(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_test_error_500(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_agent_to_server_test_error_502(self) -> None: + """Integration test for create_agent_to_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_agent_to_server_test_happy_path(self) -> None: + """Integration test for delete_agent_to_server_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_agent_to_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_agent_to_server_test_error_401(self) -> None: + """Integration test for delete_agent_to_server_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_test_error_403(self) -> None: + """Integration test for delete_agent_to_server_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_test_error_404(self) -> None: + """Integration test for delete_agent_to_server_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_test_error_429(self) -> None: + """Integration test for delete_agent_to_server_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_test_error_500(self) -> None: + """Integration test for delete_agent_to_server_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_agent_to_server_test_error_502(self) -> None: + """Integration test for delete_agent_to_server_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_server_test_happy_path(self) -> None: + """Integration test for get_agent_to_server_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_server_test_error_401(self) -> None: + """Integration test for get_agent_to_server_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_test_error_403(self) -> None: + """Integration test for get_agent_to_server_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_test_error_404(self) -> None: + """Integration test for get_agent_to_server_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_test_error_429(self) -> None: + """Integration test for get_agent_to_server_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_test_error_500(self) -> None: + """Integration test for get_agent_to_server_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_test_error_502(self) -> None: + """Integration test for get_agent_to_server_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_agent_to_server_tests_happy_path(self) -> None: + """Integration test for get_agent_to_server_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false + } ], + "_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_agent_to_server_tests_error_401(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_tests_error_403(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_tests_error_404(self) -> None: + """Integration test for get_agent_to_server_tests 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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_tests_error_429(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_tests_error_500(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_agent_to_server_tests_error_502(self) -> None: + """Integration test for get_agent_to_server_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_agent_to_server_test_happy_path(self) -> None: + """Integration test for update_agent_to_server_test success path""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_agent_to_server_test_error_400(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 400)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_test_error_401(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 401)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_test_error_403(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 403)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_test_error_404(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 404)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_test_error_429(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 429)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_test_error_500(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 500)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_agent_to_server_test_error_502(self) -> None: + """Integration test for update_agent_to_server_test error path (HTTP 502)""" + request_body_json = """ + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """ + update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py new file mode 100644 index 00000000..7d809ede --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py @@ -0,0 +1,4680 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.api_tests_api import APITestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestAPITestsApiIntegration(IntegrationTestBase): + """APITestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = APITestsApi(self.api_client) + + + def test_create_api_test_happy_path(self) -> None: + """Integration test for create_api_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_api_test_error_400(self) -> None: + """Integration test for create_api_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_test_error_401(self) -> None: + """Integration test for create_api_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_test_error_403(self) -> None: + """Integration test for create_api_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_test_error_404(self) -> None: + """Integration test for create_api_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_test_error_429(self) -> None: + """Integration test for create_api_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_test_error_500(self) -> None: + """Integration test for create_api_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_api_test_error_502(self) -> None: + """Integration test for create_api_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_api_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_api_test_happy_path(self) -> None: + """Integration test for delete_api_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_api_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_api_test_error_401(self) -> None: + """Integration test for delete_api_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_api_test_error_403(self) -> None: + """Integration test for delete_api_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_api_test_error_404(self) -> None: + """Integration test for delete_api_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_api_test_error_429(self) -> None: + """Integration test for delete_api_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_api_test_error_500(self) -> None: + """Integration test for delete_api_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_api_test_error_502(self) -> None: + """Integration test for delete_api_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_api_test_happy_path(self) -> None: + """Integration test for get_api_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_api_test_error_401(self) -> None: + """Integration test for get_api_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_test_error_403(self) -> None: + """Integration test for get_api_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_test_error_404(self) -> None: + """Integration test for get_api_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_test_error_429(self) -> None: + """Integration test for get_api_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_test_error_500(self) -> None: + """Integration test for get_api_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_test_error_502(self) -> None: + """Integration test for get_api_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_api_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_api_tests_happy_path(self) -> None: + """Integration test for get_api_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } ], + "_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_api_tests_error_401(self) -> None: + """Integration test for get_api_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_tests_error_403(self) -> None: + """Integration test for get_api_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_tests_error_404(self) -> None: + """Integration test for get_api_tests 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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_tests_error_429(self) -> None: + """Integration test for get_api_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_tests_error_500(self) -> None: + """Integration test for get_api_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_api_tests_error_502(self) -> None: + """Integration test for get_api_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_api_test_happy_path(self) -> None: + """Integration test for update_api_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : 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 + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_api_test_error_400(self) -> None: + """Integration test for update_api_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_api_test_error_401(self) -> None: + """Integration test for update_api_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_api_test_error_403(self) -> None: + """Integration test for update_api_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_api_test_error_404(self) -> None: + """Integration test for update_api_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_api_test_error_429(self) -> None: + """Integration test for update_api_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_api_test_error_500(self) -> None: + """Integration test for update_api_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_api_test_error_502(self) -> None: + """Integration test for update_api_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """ + api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_api_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py new file mode 100644 index 00000000..b44993e3 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py @@ -0,0 +1,2039 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.bgp_tests_api import BGPTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestBGPTestsApiIntegration(IntegrationTestBase): + """BGPTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = BGPTestsApi(self.api_client) + + + def test_create_bgp_test_happy_path(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : 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" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_bgp_test_error_400(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_bgp_test_error_401(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_bgp_test_error_403(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_bgp_test_error_404(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_bgp_test_error_429(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_bgp_test_error_500(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_bgp_test_error_502(self) -> None: + """Integration test for create_bgp_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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_bgp_test_happy_path(self) -> None: + """Integration test for delete_bgp_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_bgp_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_bgp_test_error_401(self) -> None: + """Integration test for delete_bgp_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_bgp_test_error_403(self) -> None: + """Integration test for delete_bgp_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_bgp_test_error_404(self) -> None: + """Integration test for delete_bgp_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_bgp_test_error_429(self) -> None: + """Integration test for delete_bgp_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_bgp_test_error_500(self) -> None: + """Integration test for delete_bgp_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_bgp_test_error_502(self) -> None: + """Integration test for delete_bgp_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_bgp_test_happy_path(self) -> None: + """Integration test for get_bgp_test success path""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : 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" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_bgp_test_error_401(self) -> None: + """Integration test for get_bgp_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_test_error_403(self) -> None: + """Integration test for get_bgp_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_test_error_404(self) -> None: + """Integration test for get_bgp_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_test_error_429(self) -> None: + """Integration test for get_bgp_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_test_error_500(self) -> None: + """Integration test for get_bgp_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_test_error_502(self) -> None: + """Integration test for get_bgp_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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_bgp_test( + test_id=test_id, + aid=aid, + expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_bgp_tests_happy_path(self) -> None: + """Integration test for get_bgp_tests success path""" + aid = '1234' + response_body_json = """ + { + "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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "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, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_bgp_tests_error_401(self) -> None: + """Integration test for get_bgp_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_tests_error_403(self) -> None: + """Integration test for get_bgp_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_tests_error_404(self) -> None: + """Integration test for get_bgp_tests 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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_tests_error_429(self) -> None: + """Integration test for get_bgp_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_tests_error_500(self) -> None: + """Integration test for get_bgp_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_tests_error_502(self) -> None: + """Integration test for get_bgp_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_bgp_test_happy_path(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : 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" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_bgp_test_error_400(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_bgp_test_error_401(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_bgp_test_error_403(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_bgp_test_error_404(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_bgp_test_error_429(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_bgp_test_error_500(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_bgp_test_error_502(self) -> None: + """Integration test for update_bgp_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" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """ + update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] + 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.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py new file mode 100644 index 00000000..360f2383 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py @@ -0,0 +1,2647 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.dns_server_tests_api import DNSServerTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDNSServerTestsApiIntegration(IntegrationTestBase): + """DNSServerTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DNSServerTestsApi(self.api_client) + + + def test_create_dns_server_test_happy_path(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dns_server_test_error_400(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_server_test_error_401(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_server_test_error_403(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_server_test_error_404(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_server_test_error_429(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_server_test_error_500(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_server_test_error_502(self) -> None: + """Integration test for create_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dns_server_test_happy_path(self) -> None: + """Integration test for delete_dns_server_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_dns_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dns_server_test_error_401(self) -> None: + """Integration test for delete_dns_server_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_server_test_error_403(self) -> None: + """Integration test for delete_dns_server_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_server_test_error_404(self) -> None: + """Integration test for delete_dns_server_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_server_test_error_429(self) -> None: + """Integration test for delete_dns_server_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_server_test_error_500(self) -> None: + """Integration test for delete_dns_server_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_server_test_error_502(self) -> None: + """Integration test for delete_dns_server_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dns_server_test_happy_path(self) -> None: + """Integration test for get_dns_server_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dns_server_test_error_401(self) -> None: + """Integration test for get_dns_server_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_test_error_403(self) -> None: + """Integration test for get_dns_server_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_test_error_404(self) -> None: + """Integration test for get_dns_server_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_test_error_429(self) -> None: + """Integration test for get_dns_server_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_test_error_500(self) -> None: + """Integration test for get_dns_server_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_test_error_502(self) -> None: + """Integration test for get_dns_server_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dns_server_tests_happy_path(self) -> None: + """Integration test for get_dns_server_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dns_server_tests_error_401(self) -> None: + """Integration test for get_dns_server_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_tests_error_403(self) -> None: + """Integration test for get_dns_server_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_tests_error_404(self) -> None: + """Integration test for get_dns_server_tests 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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_tests_error_429(self) -> None: + """Integration test for get_dns_server_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_tests_error_500(self) -> None: + """Integration test for get_dns_server_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_server_tests_error_502(self) -> None: + """Integration test for get_dns_server_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dns_server_test_happy_path(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_dns_server_test_error_400(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_server_test_error_401(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_server_test_error_403(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_server_test_error_404(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_server_test_error_429(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_server_test_error_500(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_server_test_error_502(self) -> None: + """Integration test for update_dns_server_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py new file mode 100644 index 00000000..f8a9ed68 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py @@ -0,0 +1,2283 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.dns_trace_tests_api import DNSTraceTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDNSTraceTestsApiIntegration(IntegrationTestBase): + """DNSTraceTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DNSTraceTestsApi(self.api_client) + + + def test_create_dns_trace_test_happy_path(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dns_trace_test_error_400(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_trace_test_error_401(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_trace_test_error_403(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_trace_test_error_404(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_trace_test_error_429(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_trace_test_error_500(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_trace_test_error_502(self) -> None: + """Integration test for create_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dns_trace_test_happy_path(self) -> None: + """Integration test for delete_dns_trace_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_dns_trace_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dns_trace_test_error_401(self) -> None: + """Integration test for delete_dns_trace_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_trace_test_error_403(self) -> None: + """Integration test for delete_dns_trace_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_trace_test_error_404(self) -> None: + """Integration test for delete_dns_trace_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_trace_test_error_429(self) -> None: + """Integration test for delete_dns_trace_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_trace_test_error_500(self) -> None: + """Integration test for delete_dns_trace_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_trace_test_error_502(self) -> None: + """Integration test for delete_dns_trace_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dns_trace_test_happy_path(self) -> None: + """Integration test for get_dns_trace_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dns_trace_test_error_401(self) -> None: + """Integration test for get_dns_trace_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_test_error_403(self) -> None: + """Integration test for get_dns_trace_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_test_error_404(self) -> None: + """Integration test for get_dns_trace_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_test_error_429(self) -> None: + """Integration test for get_dns_trace_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_test_error_500(self) -> None: + """Integration test for get_dns_trace_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_test_error_502(self) -> None: + """Integration test for get_dns_trace_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dns_trace_tests_happy_path(self) -> None: + """Integration test for get_dns_trace_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dns_trace_tests_error_401(self) -> None: + """Integration test for get_dns_trace_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_tests_error_403(self) -> None: + """Integration test for get_dns_trace_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_tests_error_404(self) -> None: + """Integration test for get_dns_trace_tests 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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_tests_error_429(self) -> None: + """Integration test for get_dns_trace_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_tests_error_500(self) -> None: + """Integration test for get_dns_trace_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_trace_tests_error_502(self) -> None: + """Integration test for get_dns_trace_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dns_trace_test_happy_path(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_dns_trace_test_error_400(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_trace_test_error_401(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_trace_test_error_403(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_trace_test_error_404(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_trace_test_error_429(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_trace_test_error_500(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_trace_test_error_502(self) -> None: + """Integration test for update_dns_trace_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py new file mode 100644 index 00000000..9658965d --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py @@ -0,0 +1,2262 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.dnssec_tests_api import DNSSECTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDNSSECTestsApiIntegration(IntegrationTestBase): + """DNSSECTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DNSSECTestsApi(self.api_client) + + + def test_create_dns_sec_test_happy_path(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dns_sec_test_error_400(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_sec_test_error_401(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_sec_test_error_403(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_sec_test_error_404(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_sec_test_error_429(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_sec_test_error_500(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dns_sec_test_error_502(self) -> None: + """Integration test for create_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dns_sec_test_happy_path(self) -> None: + """Integration test for delete_dns_sec_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_dns_sec_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dns_sec_test_error_401(self) -> None: + """Integration test for delete_dns_sec_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_sec_test_error_403(self) -> None: + """Integration test for delete_dns_sec_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_sec_test_error_404(self) -> None: + """Integration test for delete_dns_sec_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_sec_test_error_429(self) -> None: + """Integration test for delete_dns_sec_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_sec_test_error_500(self) -> None: + """Integration test for delete_dns_sec_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dns_sec_test_error_502(self) -> None: + """Integration test for delete_dns_sec_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dns_sec_test_happy_path(self) -> None: + """Integration test for get_dns_sec_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dns_sec_test_error_401(self) -> None: + """Integration test for get_dns_sec_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_test_error_403(self) -> None: + """Integration test for get_dns_sec_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_test_error_404(self) -> None: + """Integration test for get_dns_sec_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_test_error_429(self) -> None: + """Integration test for get_dns_sec_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_test_error_500(self) -> None: + """Integration test for get_dns_sec_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_test_error_502(self) -> None: + """Integration test for get_dns_sec_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dns_sec_tests_happy_path(self) -> None: + """Integration test for get_dns_sec_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "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", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dns_sec_tests_error_401(self) -> None: + """Integration test for get_dns_sec_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_tests_error_403(self) -> None: + """Integration test for get_dns_sec_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_tests_error_404(self) -> None: + """Integration test for get_dns_sec_tests 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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_tests_error_429(self) -> None: + """Integration test for get_dns_sec_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_tests_error_500(self) -> None: + """Integration test for get_dns_sec_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dns_sec_tests_error_502(self) -> None: + """Integration test for get_dns_sec_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dns_sec_test_happy_path(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : 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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_dns_sec_test_error_400(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_sec_test_error_401(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_sec_test_error_403(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_sec_test_error_404(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_sec_test_error_429(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_sec_test_error_500(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dns_sec_test_error_502(self) -> None: + """Integration test for update_dns_sec_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """ + dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py new file mode 100644 index 00000000..19a88ead --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py @@ -0,0 +1,2676 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.ftp_server_tests_api import FTPServerTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestFTPServerTestsApiIntegration(IntegrationTestBase): + """FTPServerTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = FTPServerTestsApi(self.api_client) + + + def test_create_ftp_server_test_happy_path(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_ftp_server_test_error_400(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_ftp_server_test_error_401(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_ftp_server_test_error_403(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_ftp_server_test_error_404(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_ftp_server_test_error_429(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_ftp_server_test_error_500(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_ftp_server_test_error_502(self) -> None: + """Integration test for create_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_ftp_server_test_happy_path(self) -> None: + """Integration test for delete_ftp_server_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_ftp_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_ftp_server_test_error_401(self) -> None: + """Integration test for delete_ftp_server_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_ftp_server_test_error_403(self) -> None: + """Integration test for delete_ftp_server_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_ftp_server_test_error_404(self) -> None: + """Integration test for delete_ftp_server_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_ftp_server_test_error_429(self) -> None: + """Integration test for delete_ftp_server_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_ftp_server_test_error_500(self) -> None: + """Integration test for delete_ftp_server_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_ftp_server_test_happy_path(self) -> None: + """Integration test for get_ftp_server_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_ftp_server_test_error_401(self) -> None: + """Integration test for get_ftp_server_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_test_error_403(self) -> None: + """Integration test for get_ftp_server_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_test_error_404(self) -> None: + """Integration test for get_ftp_server_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_test_error_429(self) -> None: + """Integration test for get_ftp_server_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_test_error_500(self) -> None: + """Integration test for get_ftp_server_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_test_error_502(self) -> None: + """Integration test for get_ftp_server_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_ftp_server_tests_happy_path(self) -> None: + """Integration test for get_ftp_server_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" + } ], + "_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_ftp_server_tests_error_401(self) -> None: + """Integration test for get_ftp_server_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_tests_error_403(self) -> None: + """Integration test for get_ftp_server_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_tests_error_404(self) -> None: + """Integration test for get_ftp_server_tests 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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_tests_error_429(self) -> None: + """Integration test for get_ftp_server_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_tests_error_500(self) -> None: + """Integration test for get_ftp_server_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_ftp_server_tests_error_502(self) -> None: + """Integration test for get_ftp_server_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_ftp_server_test_happy_path(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_ftp_server_test_error_400(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_ftp_server_test_error_401(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_ftp_server_test_error_403(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_ftp_server_test_error_404(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_ftp_server_test_error_429(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_ftp_server_test_error_500(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_ftp_server_test_error_502(self) -> None: + """Integration test for update_ftp_server_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, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """ + ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py new file mode 100644 index 00000000..665cb219 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py @@ -0,0 +1,3772 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.http_server_tests_api import HTTPServerTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestHTTPServerTestsApiIntegration(IntegrationTestBase): + """HTTPServerTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = HTTPServerTestsApi(self.api_client) + + + def test_create_http_server_test_happy_path(self) -> None: + """Integration test for create_http_server_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \"example\" : \"value\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_http_server_test_error_400(self) -> None: + """Integration test for create_http_server_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_test_error_401(self) -> None: + """Integration test for create_http_server_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_test_error_403(self) -> None: + """Integration test for create_http_server_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_test_error_404(self) -> None: + """Integration test for create_http_server_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_test_error_429(self) -> None: + """Integration test for create_http_server_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_test_error_500(self) -> None: + """Integration test for create_http_server_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_http_server_test_error_502(self) -> None: + """Integration test for create_http_server_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_http_server_test_happy_path(self) -> None: + """Integration test for delete_http_server_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_http_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_http_server_test_error_401(self) -> None: + """Integration test for delete_http_server_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_test_error_403(self) -> None: + """Integration test for delete_http_server_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_test_error_404(self) -> None: + """Integration test for delete_http_server_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_test_error_429(self) -> None: + """Integration test for delete_http_server_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_test_error_500(self) -> None: + """Integration test for delete_http_server_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_http_server_test_error_502(self) -> None: + """Integration test for delete_http_server_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_http_server_test_happy_path(self) -> None: + """Integration test for get_http_server_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \"example\" : \"value\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_http_server_test_error_401(self) -> None: + """Integration test for get_http_server_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_test_error_403(self) -> None: + """Integration test for get_http_server_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_test_error_404(self) -> None: + """Integration test for get_http_server_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_test_error_429(self) -> None: + """Integration test for get_http_server_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_test_error_500(self) -> None: + """Integration test for get_http_server_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_test_error_502(self) -> None: + """Integration test for get_http_server_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_http_server_tests_happy_path(self) -> None: + """Integration test for get_http_server_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \"example\" : \"value\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \"example\" : \"value\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_http_server_tests_error_401(self) -> None: + """Integration test for get_http_server_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_tests_error_403(self) -> None: + """Integration test for get_http_server_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_tests_error_404(self) -> None: + """Integration test for get_http_server_tests 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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_tests_error_429(self) -> None: + """Integration test for get_http_server_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_tests_error_500(self) -> None: + """Integration test for get_http_server_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_http_server_tests_error_502(self) -> None: + """Integration test for get_http_server_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_http_server_test_happy_path(self) -> None: + """Integration test for update_http_server_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "postBody" : "{ \"example\" : \"value\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_http_server_test_error_400(self) -> None: + """Integration test for update_http_server_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_test_error_401(self) -> None: + """Integration test for update_http_server_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_test_error_403(self) -> None: + """Integration test for update_http_server_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_test_error_404(self) -> None: + """Integration test for update_http_server_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_test_error_429(self) -> None: + """Integration test for update_http_server_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_test_error_500(self) -> None: + """Integration test for update_http_server_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_http_server_test_error_502(self) -> None: + """Integration test for update_http_server_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py new file mode 100644 index 00000000..1a222235 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py @@ -0,0 +1,3982 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.page_load_tests_api import PageLoadTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestPageLoadTestsApiIntegration(IntegrationTestBase): + """PageLoadTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = PageLoadTestsApi(self.api_client) + + + def test_create_page_load_test_happy_path(self) -> None: + """Integration test for create_page_load_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_page_load_test_error_400(self) -> None: + """Integration test for create_page_load_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_test_error_401(self) -> None: + """Integration test for create_page_load_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_test_error_403(self) -> None: + """Integration test for create_page_load_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_test_error_404(self) -> None: + """Integration test for create_page_load_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_test_error_429(self) -> None: + """Integration test for create_page_load_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_test_error_500(self) -> None: + """Integration test for create_page_load_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_page_load_test_error_502(self) -> None: + """Integration test for create_page_load_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_page_load_test_happy_path(self) -> None: + """Integration test for delete_page_load_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_page_load_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_page_load_test_error_401(self) -> None: + """Integration test for delete_page_load_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_page_load_test_error_403(self) -> None: + """Integration test for delete_page_load_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_page_load_test_error_404(self) -> None: + """Integration test for delete_page_load_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_page_load_test_error_429(self) -> None: + """Integration test for delete_page_load_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_page_load_test_error_500(self) -> None: + """Integration test for delete_page_load_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_page_load_test_error_502(self) -> None: + """Integration test for delete_page_load_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_page_load_test_happy_path(self) -> None: + """Integration test for get_page_load_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_page_load_test_error_401(self) -> None: + """Integration test for get_page_load_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_test_error_403(self) -> None: + """Integration test for get_page_load_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_test_error_404(self) -> None: + """Integration test for get_page_load_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_test_error_429(self) -> None: + """Integration test for get_page_load_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_test_error_500(self) -> None: + """Integration test for get_page_load_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_test_error_502(self) -> None: + """Integration test for get_page_load_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_page_load_tests_happy_path(self) -> None: + """Integration test for get_page_load_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_page_load_tests_error_401(self) -> None: + """Integration test for get_page_load_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_403(self) -> None: + """Integration test for get_page_load_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_404(self) -> None: + """Integration test for get_page_load_tests 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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_429(self) -> None: + """Integration test for get_page_load_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_500(self) -> None: + """Integration test for get_page_load_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_502(self) -> None: + """Integration test for get_page_load_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_page_load_test_happy_path(self) -> None: + """Integration test for update_page_load_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_page_load_test_error_400(self) -> None: + """Integration test for update_page_load_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_page_load_test_error_401(self) -> None: + """Integration test for update_page_load_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_page_load_test_error_403(self) -> None: + """Integration test for update_page_load_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_page_load_test_error_404(self) -> None: + """Integration test for update_page_load_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_page_load_test_error_429(self) -> None: + """Integration test for update_page_load_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_page_load_test_error_500(self) -> None: + """Integration test for update_page_load_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_page_load_test_error_502(self) -> None: + """Integration test for update_page_load_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py b/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py new file mode 100644 index 00000000..66b10d05 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py @@ -0,0 +1,976 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.path_visualization_interface_groups_api import PathVisualizationInterfaceGroupsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): + """PathVisualizationInterfaceGroupsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = PathVisualizationInterfaceGroupsApi(self.api_client) + + + def test_create_path_vis_interface_groups_happy_path(self) -> None: + """Integration test for create_path_vis_interface_groups success path""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_path_vis_interface_groups_error_400(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 400)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_path_vis_interface_groups_error_401(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 401)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_path_vis_interface_groups_error_403(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 403)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_path_vis_interface_groups_error_404(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 404)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_path_vis_interface_groups_error_429(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 429)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_path_vis_interface_groups_error_500(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 500)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_path_vis_interface_groups_error_502(self) -> None: + """Integration test for create_path_vis_interface_groups error path (HTTP 502)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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(502) + ) as context: + self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_path_vis_interface_group_happy_path(self) -> None: + """Integration test for delete_path_vis_interface_group success path""" + interface_group_id = '281474976710706' + aid = '1234' + response = self.api.delete_path_vis_interface_group_with_http_info( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_path_vis_interface_group_error_401(self) -> None: + """Integration test for delete_path_vis_interface_group error path (HTTP 401)""" + interface_group_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.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_path_vis_interface_group_error_403(self) -> None: + """Integration test for delete_path_vis_interface_group error path (HTTP 403)""" + interface_group_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.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_path_vis_interface_group_error_404(self) -> None: + """Integration test for delete_path_vis_interface_group error path (HTTP 404)""" + interface_group_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.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_path_vis_interface_group_error_429(self) -> None: + """Integration test for delete_path_vis_interface_group error path (HTTP 429)""" + interface_group_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.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_path_vis_interface_group_error_500(self) -> None: + """Integration test for delete_path_vis_interface_group error path (HTTP 500)""" + interface_group_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.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_path_vis_interface_group_error_502(self) -> None: + """Integration test for delete_path_vis_interface_group error path (HTTP 502)""" + interface_group_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.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_path_vis_interface_groups_happy_path(self) -> None: + """Integration test for get_path_vis_interface_groups success path""" + aid = '1234' + response_body_json = """ + { + "pathVisInterfaceGroups" : [ { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + }, { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } ], + "_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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_path_vis_interface_groups_error_401(self) -> None: + """Integration test for get_path_vis_interface_groups 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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_path_vis_interface_groups_error_403(self) -> None: + """Integration test for get_path_vis_interface_groups 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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_path_vis_interface_groups_error_404(self) -> None: + """Integration test for get_path_vis_interface_groups 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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_path_vis_interface_groups_error_429(self) -> None: + """Integration test for get_path_vis_interface_groups 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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_path_vis_interface_groups_error_500(self) -> None: + """Integration test for get_path_vis_interface_groups 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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_path_vis_interface_groups_error_502(self) -> None: + """Integration test for get_path_vis_interface_groups 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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_path_vis_interface_group_happy_path(self) -> None: + """Integration test for update_path_vis_interface_group success path""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_id = '281474976710706' + aid = '1234' + response_body_json = """ + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_path_vis_interface_group_error_400(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 400)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_id = '281474976710706' + 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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_path_vis_interface_group_error_401(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 401)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_path_vis_interface_group_error_403(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 403)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_path_vis_interface_group_error_404(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 404)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_path_vis_interface_group_error_429(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 429)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_path_vis_interface_group_error_500(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 500)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_path_vis_interface_group_error_502(self) -> None: + """Integration test for update_path_vis_interface_group error path (HTTP 502)""" + request_body_json = """ + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """ + interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) + interface_group_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.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py new file mode 100644 index 00000000..b9807590 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py @@ -0,0 +1,2687 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.sip_server_tests_api import SIPServerTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestSIPServerTestsApiIntegration(IntegrationTestBase): + """SIPServerTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = SIPServerTestsApi(self.api_client) + + + def test_create_sip_server_test_happy_path(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_sip_server_test_error_400(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_sip_server_test_error_401(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_sip_server_test_error_403(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_sip_server_test_error_404(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_sip_server_test_error_429(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_sip_server_test_error_500(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_sip_server_test_error_502(self) -> None: + """Integration test for create_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_sip_server_test_happy_path(self) -> None: + """Integration test for delete_sip_server_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_sip_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_sip_server_test_error_401(self) -> None: + """Integration test for delete_sip_server_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_sip_server_test_error_403(self) -> None: + """Integration test for delete_sip_server_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_sip_server_test_error_404(self) -> None: + """Integration test for delete_sip_server_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_sip_server_test_error_429(self) -> None: + """Integration test for delete_sip_server_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_sip_server_test_error_500(self) -> None: + """Integration test for delete_sip_server_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_sip_server_test_happy_path(self) -> None: + """Integration test for get_sip_server_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_sip_server_test_error_401(self) -> None: + """Integration test for get_sip_server_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_test_error_403(self) -> None: + """Integration test for get_sip_server_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_test_error_404(self) -> None: + """Integration test for get_sip_server_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_test_error_429(self) -> None: + """Integration test for get_sip_server_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_test_error_500(self) -> None: + """Integration test for get_sip_server_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_test_error_502(self) -> None: + """Integration test for get_sip_server_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_sip_server_tests_happy_path(self) -> None: + """Integration test for get_sip_server_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "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", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\"a-z\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" + }, { + "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", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\"a-z\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" + } ], + "_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_sip_server_tests_error_401(self) -> None: + """Integration test for get_sip_server_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_tests_error_403(self) -> None: + """Integration test for get_sip_server_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_tests_error_404(self) -> None: + """Integration test for get_sip_server_tests 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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_tests_error_429(self) -> None: + """Integration test for get_sip_server_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_tests_error_500(self) -> None: + """Integration test for get_sip_server_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_sip_server_tests_error_502(self) -> None: + """Integration test for get_sip_server_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_sip_server_test_happy_path(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_sip_server_test_error_400(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_sip_server_test_error_401(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_sip_server_test_error_403(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_sip_server_test_error_404(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_sip_server_test_error_429(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_sip_server_test_error_500(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_sip_server_test_error_502(self) -> None: + """Integration test for update_sip_server_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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_tests_api_integration.py new file mode 100644 index 00000000..3f595bb1 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_tests_api_integration.py @@ -0,0 +1,411 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.tests_api import TestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestTestsApiIntegration(IntegrationTestBase): + """TestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = TestsApi(self.api_client) + + + def test_get_test_version_history_happy_path(self) -> None: + """Integration test for get_test_version_history success path""" + test_id = '202701' + aid = '1234' + limit = 50 + 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" + } + }, + "testVersionHistory" : [ { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" + }, { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_version_history_error_401(self) -> None: + """Integration test for get_test_version_history error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + limit = 50 + 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_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_version_history_error_403(self) -> None: + """Integration test for get_test_version_history error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + limit = 50 + 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_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_version_history_error_404(self) -> None: + """Integration test for get_test_version_history error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + limit = 50 + 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_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_version_history_error_500(self) -> None: + """Integration test for get_test_version_history error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + limit = 50 + 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_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_tests_happy_path(self) -> None: + """Integration test for get_tests success path""" + aid = '1234' + response_body_json = """ + { + "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" + } ], + "_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_tests( + aid=aid, + _headers=self.te_headers("get_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_tests_error_401(self) -> None: + """Integration test for get_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_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_error_403(self) -> None: + """Integration test for get_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_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_error_404(self) -> None: + """Integration test for get_tests 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_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_error_429(self) -> None: + """Integration test for get_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_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_error_500(self) -> None: + """Integration test for get_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_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_error_502(self) -> None: + """Integration test for get_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_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py new file mode 100644 index 00000000..57835ee1 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py @@ -0,0 +1,2512 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.voice_tests_api import VoiceTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestVoiceTestsApiIntegration(IntegrationTestBase): + """VoiceTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = VoiceTestsApi(self.api_client) + + + def test_create_voice_test_happy_path(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_voice_test_error_400(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_voice_test_error_401(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_voice_test_error_403(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_voice_test_error_404(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_voice_test_error_429(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_voice_test_error_500(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_voice_test_error_502(self) -> None: + """Integration test for create_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_test( + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_voice_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_voice_test_happy_path(self) -> None: + """Integration test for delete_voice_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_voice_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_voice_test_error_401(self) -> None: + """Integration test for delete_voice_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_voice_test_error_403(self) -> None: + """Integration test for delete_voice_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_voice_test_error_404(self) -> None: + """Integration test for delete_voice_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_voice_test_error_429(self) -> None: + """Integration test for delete_voice_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_voice_test_error_500(self) -> None: + """Integration test for delete_voice_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_voice_test_error_502(self) -> None: + """Integration test for delete_voice_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_voice_test_happy_path(self) -> None: + """Integration test for get_voice_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_voice_test_error_401(self) -> None: + """Integration test for get_voice_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_test_error_403(self) -> None: + """Integration test for get_voice_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_test_error_404(self) -> None: + """Integration test for get_voice_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_test_error_429(self) -> None: + """Integration test for get_voice_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_test_error_500(self) -> None: + """Integration test for get_voice_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_test_error_502(self) -> None: + """Integration test for get_voice_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_voice_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_voice_tests_happy_path(self) -> None: + """Integration test for get_voice_tests success path""" + aid = '1234' + response_body_json = """ + { + "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" + } + }, + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : 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", + "interval" : 60, + "testId" : "281474976710706" + }, { + "_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", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : 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", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_voice_tests_error_401(self) -> None: + """Integration test for get_voice_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_tests_error_403(self) -> None: + """Integration test for get_voice_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_tests_error_404(self) -> None: + """Integration test for get_voice_tests 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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_tests_error_429(self) -> None: + """Integration test for get_voice_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_tests_error_500(self) -> None: + """Integration test for get_voice_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_voice_tests_error_502(self) -> None: + """Integration test for get_voice_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_voice_test_happy_path(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_voice_test_error_400(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_voice_test_error_401(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_voice_test_error_403(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_voice_test_error_404(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_voice_test_error_429(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_voice_test_error_500(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_voice_test_error_502(self) -> None: + """Integration test for update_voice_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" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """ + voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_voice_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py new file mode 100644 index 00000000..b0f5f56f --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py @@ -0,0 +1,4001 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.web_transaction_tests_api import WebTransactionTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebTransactionTestsApiIntegration(IntegrationTestBase): + """WebTransactionTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebTransactionTestsApi(self.api_client) + + + def test_create_web_transactions_test_happy_path(self) -> None: + """Integration test for create_web_transactions_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_web_transactions_test_error_400(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transactions_test_error_401(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transactions_test_error_403(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transactions_test_error_404(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transactions_test_error_429(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transactions_test_error_500(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_web_transactions_test_error_502(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_web_transactions_test_happy_path(self) -> None: + """Integration test for delete_web_transactions_test success path""" + test_id = '202701' + aid = '1234' + response = self.api.delete_web_transactions_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_web_transactions_test_error_401(self) -> None: + """Integration test for delete_web_transactions_test error path (HTTP 401)""" + test_id = '202701' + 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.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_web_transactions_test_error_403(self) -> None: + """Integration test for delete_web_transactions_test error path (HTTP 403)""" + test_id = '202701' + 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.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_web_transactions_test_error_404(self) -> None: + """Integration test for delete_web_transactions_test error path (HTTP 404)""" + test_id = '202701' + 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.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_web_transactions_test_error_429(self) -> None: + """Integration test for delete_web_transactions_test error path (HTTP 429)""" + test_id = '202701' + 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.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_web_transactions_test_error_500(self) -> None: + """Integration test for delete_web_transactions_test error path (HTTP 500)""" + test_id = '202701' + 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.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_web_transactions_test_error_502(self) -> None: + """Integration test for delete_web_transactions_test error path (HTTP 502)""" + test_id = '202701' + 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.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_web_transactions_test_happy_path(self) -> None: + """Integration test for get_web_transactions_test success path""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_web_transactions_test_error_401(self) -> None: + """Integration test for get_web_transactions_test error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_test_error_403(self) -> None: + """Integration test for get_web_transactions_test error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_test_error_404(self) -> None: + """Integration test for get_web_transactions_test error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_test_error_429(self) -> None: + """Integration test for get_web_transactions_test error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_test_error_500(self) -> None: + """Integration test for get_web_transactions_test error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_test_error_502(self) -> None: + """Integration test for get_web_transactions_test error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + version_id = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, + expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_web_transactions_tests_happy_path(self) -> None: + """Integration test for get_web_transactions_tests success path""" + aid = '1234' + response_body_json = """ + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } ], + "_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_web_transactions_tests_error_401(self) -> None: + """Integration test for get_web_transactions_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_403(self) -> None: + """Integration test for get_web_transactions_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_404(self) -> None: + """Integration test for get_web_transactions_tests 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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_429(self) -> None: + """Integration test for get_web_transactions_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_500(self) -> None: + """Integration test for get_web_transactions_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_502(self) -> None: + """Integration test for get_web_transactions_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_web_transactions_test_happy_path(self) -> None: + """Integration test for update_web_transactions_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\"ProxyMode\":\"direct\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "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" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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 + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_web_transactions_test_error_400(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_web_transactions_test_error_401(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 401)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_web_transactions_test_error_403(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 403)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_web_transactions_test_error_404(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 404)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_web_transactions_test_error_429(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 429)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_web_transactions_test_error_500(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 500)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_web_transactions_test_error_502(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 502)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_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" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + expand = [thousandeyes_sdk.tests.ExpandTestOptions()] + 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.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, + expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-usage/test/conftest.py b/thousandeyes-sdk-usage/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-usage/test/conftest.py @@ -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)) diff --git a/thousandeyes-sdk-usage/test/integration_test_utils.py b/thousandeyes-sdk-usage/test/integration_test_utils.py new file mode 100644 index 00000000..21833c98 --- /dev/null +++ b/thousandeyes-sdk-usage/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Usage API + + These usage endpoints define the following operations: * **Usage**: Retrieve usage data for the specified time period (default is one month). * Users must have the `View organization usage` permission to access this endpoint. * This operation offers visibility across all account groups within the organization. * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization. * The `agentId` field in enterprise agent unit responses may be omitted when not available. * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas. * Users must have the necessary permissions to perform quota-related actions. Refer to the Usage API operations for detailed usage instructions and optional parameters. + + 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 diff --git a/thousandeyes-sdk-usage/test/mock_manifest.py b/thousandeyes-sdk-usage/test/mock_manifest.py new file mode 100644 index 00000000..4ce9a01c --- /dev/null +++ b/thousandeyes-sdk-usage/test/mock_manifest.py @@ -0,0 +1,1183 @@ +# coding: utf-8 + +""" + Usage API + + These usage endpoints define the following operations: * **Usage**: Retrieve usage data for the specified time period (default is one month). * Users must have the `View organization usage` permission to access this endpoint. * This operation offers visibility across all account groups within the organization. * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization. * The `agentId` field in enterprise agent unit responses may be omitted when not available. * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas. * Users must have the necessary permissions to perform quota-related actions. Refer to the Usage API operations for detailed usage instructions and optional parameters. + + 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 = { + + "assign_organizations_account_groups_quotas": OperationExpectation( + operation_id="assign_organizations_account_groups_quotas", + method="POST", + path="/quotas/account-groups/assign", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """), + 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", + ), + + }, + ), + + "assign_organizations_quotas": OperationExpectation( + operation_id="assign_organizations_quotas", + method="POST", + path="/quotas/assign", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "value" : 12000 + }, { + "orgId" : "12345", + "value" : 10000 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """), + 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", + ), + + }, + ), + + "get_quotas": OperationExpectation( + operation_id="get_quotas", + method="GET", + path="/quotas", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "quotas" : [ { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 10000, + "aid" : "12345" + } ], + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" + } + }, { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 10000, + "aid" : "12345" + } ], + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" + } + } ], + "_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={ + + "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", + ), + + }, + ), + + "unassign_organizations_account_groups_quotas": OperationExpectation( + operation_id="unassign_organizations_account_groups_quotas", + method="POST", + path="/quotas/account-groups/unassign", + path_param_examples={ + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """), + 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", + ), + + }, + ), + + "unassign_organizations_quotas": OperationExpectation( + operation_id="unassign_organizations_quotas", + method="POST", + path="/quotas/unassign", + path_param_examples={ + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "organizations" : [ "1234", "12345" ] + } + + """), + 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", + ), + + }, + ), + + "get_enterprise_agents_units_usage": OperationExpectation( + operation_id="get_enterprise_agents_units_usage", + method="GET", + path="/usage/units/enterprise-agents", + 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" + }, + "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" + } + }, + "breakdowns" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 + }, { + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_tests_units_usage": OperationExpectation( + operation_id="get_tests_units_usage", + method="GET", + path="/usage/units/tests", + 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" + }, + "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" + } + }, + "breakdowns" : [ { + "testId" : "1158", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "enterpriseUnitsUsed" : 14050, + "enterpriseUnitsProjected" : 340674, + "cloudUnitsUsed" : 10000, + "cloudUnitsProjected" : 12000, + "aid" : "1234", + "accountGroupName" : "Support" + }, { + "testId" : "1221", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web - HTTP Server", + "enterpriseUnitsUsed" : 194051, + "enterpriseUnitsProjected" : 30622, + "cloudUnitsUsed" : 12000, + "cloudUnitsProjected" : 13000, + "aid" : "1234", + "accountGroupName" : "Support" + } ] + } + + """), + + 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", + ), + + }, + ), + + "get_usage": OperationExpectation( + operation_id="get_usage", + method="GET", + path="/usage", + 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" + } + }, + "usage" : { + "cloudUnitsProjected" : 20993812, + "connectedDevicesUnitsUsed" : 79640902, + "enterpriseAgentsUsed" : 58, + "endpointAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsUsed" : 22 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsUsed" : 14 + } ], + "cloudUnitsNextBillingPeriod" : 25123456, + "enterpriseUnitsNextBillingPeriod" : 0, + "endpointAgentsUsed" : 42, + "enterpriseUnitsUsed" : 79640902, + "cloudUnitsUsed" : 8500489, + "connectedDevicesUnitsNextBillingPeriod" : 0, + "connectedDevicesUnitsProjected" : 108016317, + "tests" : [ { + "aid" : "1234", + "testId" : "1158", + "accountGroupName" : "Documentation", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "cloudUnitsUsed" : 14050, + "cloudUnitsProjected" : 340674 + }, { + "aid" : "12345", + "testId" : "1159", + "accountGroupName" : "Documentation", + "testName" : "https://support.thousandeyes.com", + "testType" : "Web - HTTP Server", + "cloudUnitsUsed" : 64390, + "cloudUnitsProjected" : 164457 + } ], + "endpointAgentsEmbedded" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEmbeddedUsed" : 2 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEmbeddedUsed" : 3 + } ], + "allocations" : { + "used" : 1000, + "projected" : 1000, + "allocations" : [ { + "productName" : "Some Product Name", + "allocatedUnits" : 600 + } ] + }, + "endpointAgentsEssentialsUsed" : 5, + "quota" : { + "monthEnd" : "2020-02-05T08:00:00Z", + "endpointAgentsEmbeddedIncluded" : 10, + "enterpriseAgentsIncluded" : 25, + "monthStart" : "2020-01-05T08:00:00Z", + "cloudUnitsIncluded" : 4320000000, + "deviceAgentsIncluded" : 100, + "endpointAgentsIncluded" : 200, + "endpointAgentsEssentialsIncluded" : 10 + }, + "enterpriseUnitsProjected" : 108016317, + "endpointAgentsEmbeddedUsed" : 5, + "enterpriseAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "enterpriseAgentsUsed" : 7 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "enterpriseAgentsUsed" : 1 + } ], + "enterpriseAgentUnits" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 + }, { + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 + } ], + "endpointAgentsEssentials" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEssentialsUsed" : 2 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEssentialsUsed" : 3 + } ] + } + } + + """), + + 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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-usage/test/test_quotas_api_integration.py b/thousandeyes-sdk-usage/test/test_quotas_api_integration.py new file mode 100644 index 00000000..6d61f6a2 --- /dev/null +++ b/thousandeyes-sdk-usage/test/test_quotas_api_integration.py @@ -0,0 +1,1280 @@ +# coding: utf-8 + +""" + Usage API + + These usage endpoints define the following operations: * **Usage**: Retrieve usage data for the specified time period (default is one month). * Users must have the `View organization usage` permission to access this endpoint. * This operation offers visibility across all account groups within the organization. * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization. * The `agentId` field in enterprise agent unit responses may be omitted when not available. * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas. * Users must have the necessary permissions to perform quota-related actions. Refer to the Usage API operations for detailed usage instructions and optional parameters. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.usage.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.usage.api.quotas_api import QuotasApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestQuotasApiIntegration(IntegrationTestBase): + """QuotasApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = QuotasApi(self.api_client) + + + def test_assign_organizations_account_groups_quotas_happy_path(self) -> None: + """Integration test for assign_organizations_account_groups_quotas success path""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + response_body_json = """ + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_assign_organizations_account_groups_quotas_error_400(self) -> None: + """Integration test for assign_organizations_account_groups_quotas error path (HTTP 400)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + 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_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_account_groups_quotas_error_401(self) -> None: + """Integration test for assign_organizations_account_groups_quotas error path (HTTP 401)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + 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_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_account_groups_quotas_error_403(self) -> None: + """Integration test for assign_organizations_account_groups_quotas error path (HTTP 403)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + 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.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_account_groups_quotas_error_404(self) -> None: + """Integration test for assign_organizations_account_groups_quotas error path (HTTP 404)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + 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.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_account_groups_quotas_error_429(self) -> None: + """Integration test for assign_organizations_account_groups_quotas error path (HTTP 429)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + 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.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_account_groups_quotas_error_500(self) -> None: + """Integration test for assign_organizations_account_groups_quotas error path (HTTP 500)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """ + organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) + 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.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_assign_organizations_quotas_happy_path(self) -> None: + """Integration test for assign_organizations_quotas success path""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + response_body_json = """ + { + "organizations" : [ { + "orgId" : "1234", + "value" : 12000 + }, { + "orgId" : "12345", + "value" : 10000 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_assign_organizations_quotas_error_400(self) -> None: + """Integration test for assign_organizations_quotas error path (HTTP 400)""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + 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_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_quotas_error_401(self) -> None: + """Integration test for assign_organizations_quotas error path (HTTP 401)""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + 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_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_quotas_error_403(self) -> None: + """Integration test for assign_organizations_quotas error path (HTTP 403)""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + 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.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_quotas_error_404(self) -> None: + """Integration test for assign_organizations_quotas error path (HTTP 404)""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + 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.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_quotas_error_429(self) -> None: + """Integration test for assign_organizations_quotas error path (HTTP 429)""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + 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.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_assign_organizations_quotas_error_500(self) -> None: + """Integration test for assign_organizations_quotas error path (HTTP 500)""" + request_body_json = """ + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """ + quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) + 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.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_quotas_happy_path(self) -> None: + """Integration test for get_quotas success path""" + response_body_json = """ + { + "quotas" : [ { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 10000, + "aid" : "12345" + } ], + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" + } + }, { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 10000, + "aid" : "12345" + } ], + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" + } + } ], + "_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_quotas( + _headers=self.te_headers("get_quotas"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_quotas_error_400(self) -> None: + """Integration test for get_quotas error path (HTTP 400)""" + 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_quotas( + _headers=self.te_headers("get_quotas", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_quotas_error_401(self) -> None: + """Integration test for get_quotas error path (HTTP 401)""" + 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_quotas( + _headers=self.te_headers("get_quotas", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_quotas_error_403(self) -> None: + """Integration test for get_quotas error path (HTTP 403)""" + 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_quotas( + _headers=self.te_headers("get_quotas", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_quotas_error_404(self) -> None: + """Integration test for get_quotas error path (HTTP 404)""" + 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_quotas( + _headers=self.te_headers("get_quotas", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_quotas_error_429(self) -> None: + """Integration test for get_quotas error path (HTTP 429)""" + 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_quotas( + _headers=self.te_headers("get_quotas", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_quotas_error_500(self) -> None: + """Integration test for get_quotas error path (HTTP 500)""" + 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_quotas( + _headers=self.te_headers("get_quotas", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_unassign_organizations_account_groups_quotas_happy_path(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas success path""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + response = self.api.unassign_organizations_account_groups_quotas_with_http_info( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_unassign_organizations_account_groups_quotas_error_400(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 400)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + 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_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_account_groups_quotas_error_401(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 401)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + 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_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_account_groups_quotas_error_403(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 403)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_account_groups_quotas_error_404(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 404)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_account_groups_quotas_error_429(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 429)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_account_groups_quotas_error_500(self) -> None: + """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 500)""" + request_body_json = """ + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """ + organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_unassign_organizations_quotas_happy_path(self) -> None: + """Integration test for unassign_organizations_quotas success path""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + response = self.api.unassign_organizations_quotas_with_http_info( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_unassign_organizations_quotas_error_400(self) -> None: + """Integration test for unassign_organizations_quotas error path (HTTP 400)""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + 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_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_quotas_error_401(self) -> None: + """Integration test for unassign_organizations_quotas error path (HTTP 401)""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + 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_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_quotas_error_403(self) -> None: + """Integration test for unassign_organizations_quotas error path (HTTP 403)""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_quotas_error_404(self) -> None: + """Integration test for unassign_organizations_quotas error path (HTTP 404)""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_quotas_error_429(self) -> None: + """Integration test for unassign_organizations_quotas error path (HTTP 429)""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_unassign_organizations_quotas_error_500(self) -> None: + """Integration test for unassign_organizations_quotas error path (HTTP 500)""" + request_body_json = """ + + { + "organizations" : [ "1234", "12345" ] + } + + """ + quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) + 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.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-usage/test/test_usage_api_integration.py b/thousandeyes-sdk-usage/test/test_usage_api_integration.py new file mode 100644 index 00000000..8f548d97 --- /dev/null +++ b/thousandeyes-sdk-usage/test/test_usage_api_integration.py @@ -0,0 +1,815 @@ +# coding: utf-8 + +""" + Usage API + + These usage endpoints define the following operations: * **Usage**: Retrieve usage data for the specified time period (default is one month). * Users must have the `View organization usage` permission to access this endpoint. * This operation offers visibility across all account groups within the organization. * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization. * The `agentId` field in enterprise agent unit responses may be omitted when not available. * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas. * Users must have the necessary permissions to perform quota-related actions. Refer to the Usage API operations for detailed usage instructions and optional parameters. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.usage.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.usage.api.usage_api import UsageApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestUsageApiIntegration(IntegrationTestBase): + """UsageApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = UsageApi(self.api_client) + + + def test_get_enterprise_agents_units_usage_happy_path(self) -> None: + """Integration test for get_enterprise_agents_units_usage success path""" + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + 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" + }, + "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" + } + }, + "breakdowns" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 + }, { + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_enterprise_agents_units_usage_error_400(self) -> None: + """Integration test for get_enterprise_agents_units_usage error path (HTTP 400)""" + 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_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_enterprise_agents_units_usage_error_401(self) -> None: + """Integration test for get_enterprise_agents_units_usage error path (HTTP 401)""" + 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_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_enterprise_agents_units_usage_error_403(self) -> None: + """Integration test for get_enterprise_agents_units_usage error path (HTTP 403)""" + 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_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_enterprise_agents_units_usage_error_404(self) -> None: + """Integration test for get_enterprise_agents_units_usage error path (HTTP 404)""" + 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_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_enterprise_agents_units_usage_error_429(self) -> None: + """Integration test for get_enterprise_agents_units_usage error path (HTTP 429)""" + 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_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_enterprise_agents_units_usage_error_500(self) -> None: + """Integration test for get_enterprise_agents_units_usage error path (HTTP 500)""" + 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_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_tests_units_usage_happy_path(self) -> None: + """Integration test for get_tests_units_usage success path""" + aid = '1234' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + 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" + }, + "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" + } + }, + "breakdowns" : [ { + "testId" : "1158", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "enterpriseUnitsUsed" : 14050, + "enterpriseUnitsProjected" : 340674, + "cloudUnitsUsed" : 10000, + "cloudUnitsProjected" : 12000, + "aid" : "1234", + "accountGroupName" : "Support" + }, { + "testId" : "1221", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web - HTTP Server", + "enterpriseUnitsUsed" : 194051, + "enterpriseUnitsProjected" : 30622, + "cloudUnitsUsed" : 12000, + "cloudUnitsProjected" : 13000, + "aid" : "1234", + "accountGroupName" : "Support" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_tests_units_usage_error_400(self) -> None: + """Integration test for get_tests_units_usage error path (HTTP 400)""" + aid = '1234' + 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_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_units_usage_error_401(self) -> None: + """Integration test for get_tests_units_usage error path (HTTP 401)""" + aid = '1234' + 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_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_units_usage_error_403(self) -> None: + """Integration test for get_tests_units_usage error path (HTTP 403)""" + aid = '1234' + 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_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_units_usage_error_404(self) -> None: + """Integration test for get_tests_units_usage error path (HTTP 404)""" + aid = '1234' + 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_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_units_usage_error_429(self) -> None: + """Integration test for get_tests_units_usage error path (HTTP 429)""" + aid = '1234' + 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_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_tests_units_usage_error_500(self) -> None: + """Integration test for get_tests_units_usage error path (HTTP 500)""" + aid = '1234' + 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_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_usage_happy_path(self) -> None: + """Integration test for get_usage success path""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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" + } + }, + "usage" : { + "cloudUnitsProjected" : 20993812, + "connectedDevicesUnitsUsed" : 79640902, + "enterpriseAgentsUsed" : 58, + "endpointAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsUsed" : 22 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsUsed" : 14 + } ], + "cloudUnitsNextBillingPeriod" : 25123456, + "enterpriseUnitsNextBillingPeriod" : 0, + "endpointAgentsUsed" : 42, + "enterpriseUnitsUsed" : 79640902, + "cloudUnitsUsed" : 8500489, + "connectedDevicesUnitsNextBillingPeriod" : 0, + "connectedDevicesUnitsProjected" : 108016317, + "tests" : [ { + "aid" : "1234", + "testId" : "1158", + "accountGroupName" : "Documentation", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "cloudUnitsUsed" : 14050, + "cloudUnitsProjected" : 340674 + }, { + "aid" : "12345", + "testId" : "1159", + "accountGroupName" : "Documentation", + "testName" : "https://support.thousandeyes.com", + "testType" : "Web - HTTP Server", + "cloudUnitsUsed" : 64390, + "cloudUnitsProjected" : 164457 + } ], + "endpointAgentsEmbedded" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEmbeddedUsed" : 2 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEmbeddedUsed" : 3 + } ], + "allocations" : { + "used" : 1000, + "projected" : 1000, + "allocations" : [ { + "productName" : "Some Product Name", + "allocatedUnits" : 600 + } ] + }, + "endpointAgentsEssentialsUsed" : 5, + "quota" : { + "monthEnd" : "2020-02-05T08:00:00Z", + "endpointAgentsEmbeddedIncluded" : 10, + "enterpriseAgentsIncluded" : 25, + "monthStart" : "2020-01-05T08:00:00Z", + "cloudUnitsIncluded" : 4320000000, + "deviceAgentsIncluded" : 100, + "endpointAgentsIncluded" : 200, + "endpointAgentsEssentialsIncluded" : 10 + }, + "enterpriseUnitsProjected" : 108016317, + "endpointAgentsEmbeddedUsed" : 5, + "enterpriseAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "enterpriseAgentsUsed" : 7 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "enterpriseAgentsUsed" : 1 + } ], + "enterpriseAgentUnits" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 + }, { + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 + } ], + "endpointAgentsEssentials" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEssentialsUsed" : 2 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEssentialsUsed" : 3 + } ] + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_usage_error_400(self) -> None: + """Integration test for get_usage error path (HTTP 400)""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_usage_error_401(self) -> None: + """Integration test for get_usage error path (HTTP 401)""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_usage_error_403(self) -> None: + """Integration test for get_usage error path (HTTP 403)""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_usage_error_404(self) -> None: + """Integration test for get_usage error path (HTTP 404)""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_usage_error_429(self) -> None: + """Integration test for get_usage error path (HTTP 429)""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_usage_error_500(self) -> None: + """Integration test for get_usage error path (HTTP 500)""" + aid = '1234' + expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] + 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_usage( + aid=aid, + expand=expand, + _headers=self.te_headers("get_usage", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() From b1faff026e95914b11884eaec4062820ef00bbaf Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 28 Jul 2026 12:13:24 +0100 Subject: [PATCH 3/7] Regenerate integration tests with fixed JSON escaping and enum params. Success response bodies now use valid JSON quotes instead of HTML entities, and optional expand enum params are omitted when OpenAPI examples are invalid. Co-authored-by: Cursor --- .../test_account_groups_api_integration.py | 1460 ++++----- .../test/test_permissions_api_integration.py | 52 +- .../test/test_roles_api_integration.py | 275 +- .../test/test_user_events_api_integration.py | 149 +- .../test/test_users_api_integration.py | 580 ++-- .../test_agent_proxies_api_integration.py | 80 +- ...gent_notification_rules_api_integration.py | 257 +- ...d_and_enterprise_agents_api_integration.py | 626 ++-- ...nterprise_agent_cluster_api_integration.py | 376 +-- .../test_local_problems_api_integration.py | 102 +- ...ts_assignment_on_agents_api_integration.py | 654 ++-- .../test/test_alert_rules_api_integration.py | 656 ++-- ...ert_suppression_windows_api_integration.py | 730 +++-- .../test/test_alerts_api_integration.py | 510 ++-- ...ential_vault_operations_api_integration.py | 328 +- ...r_ark_conjur_connectors_api_integration.py | 358 ++- ...test_generic_connectors_api_integration.py | 392 ++- ...st_operation_connectors_api_integration.py | 46 +- ...test_webhook_operations_api_integration.py | 352 ++- .../test/test_credentials_api_integration.py | 248 +- ...est_dashboard_snapshots_api_integration.py | 2218 +++++++------- .../test/test_dashboards_api_integration.py | 2341 +++++++------- ...test_dashboards_filters_api_integration.py | 504 +-- .../test/test_emulation_api_integration.py | 152 +- ...ndpoint_agent_log_items_api_integration.py | 196 +- .../test_endpoint_agents_api_integration.py | 2691 +++++++++-------- ...ndpoint_agents_transfer_api_integration.py | 56 +- .../test_endpoint_proxies_api_integration.py | 56 +- ...instant_scheduled_tests_api_integration.py | 101 +- ...instant_scheduled_tests_api_integration.py | 123 +- ...instant_scheduled_tests_api_integration.py | 26 +- ...t_endpoint_agent_labels_api_integration.py | 353 ++- ..._scheduled_test_results_api_integration.py | 1797 ++++++----- ...k_endpoint_test_results_api_integration.py | 1715 ++++++----- ...c_endpoint_test_results_api_integration.py | 2215 +++++++------- ..._scheduled_test_results_api_integration.py | 2647 ++++++++-------- ...r_endpoint_test_results_api_integration.py | 1661 +++++----- ..._endpoint_dynamic_tests_api_integration.py | 525 ++-- ...ndpoint_scheduled_tests_api_integration.py | 535 ++-- ...ndpoint_real_user_tests_api_integration.py | 52 +- ...ndpoint_scheduled_tests_api_integration.py | 194 +- ...ndpoint_scheduled_tests_api_integration.py | 645 ++-- .../test/test_events_api_integration.py | 461 +-- ..._to_agent_instant_tests_api_integration.py | 226 +- ...to_server_instant_tests_api_integration.py | 228 +- .../test_api_instant_tests_api_integration.py | 390 +-- ...ns_server_instant_tests_api_integration.py | 236 +- ...dns_trace_instant_tests_api_integration.py | 206 +- ...st_dnssec_instant_tests_api_integration.py | 204 +- ...tp_server_instant_tests_api_integration.py | 236 +- ...page_load_instant_tests_api_integration.py | 336 +- ...tp_server_instant_tests_api_integration.py | 320 +- ...ip_server_instant_tests_api_integration.py | 234 +- ...est_voice_instant_tests_api_integration.py | 218 +- ...ansaction_instant_tests_api_integration.py | 340 ++- ...ights_catalog_providers_api_integration.py | 200 +- ...ternet_insights_outages_api_integration.py | 354 ++- .../test_test_snapshots_api_integration.py | 144 +- .../test/test_streaming_api_integration.py | 597 ++-- .../test_tag_assignment_api_integration.py | 288 +- .../test/test_tags_api_integration.py | 844 +++--- .../test_api_test_results_api_integration.py | 680 +++-- ...dns_server_test_results_api_integration.py | 544 ++-- ..._dns_trace_test_results_api_integration.py | 276 +- ...est_dnssec_test_results_api_integration.py | 256 +- ...etwork_bgp_test_results_api_integration.py | 476 +-- ...st_network_test_results_api_integration.py | 1056 ++++--- ...rtp_server_test_results_api_integration.py | 292 +- ...sip_server_test_results_api_integration.py | 312 +- ...ftp_server_test_results_api_integration.py | 300 +- ...ttp_server_test_results_api_integration.py | 636 ++-- ..._page_load_test_results_api_integration.py | 1148 +++---- ...ansactions_test_results_api_integration.py | 1512 ++++----- ...st_agent_to_agent_tests_api_integration.py | 1183 ++++---- ...t_agent_to_server_tests_api_integration.py | 1193 ++++---- .../test/test_api_tests_api_integration.py | 1979 ++++++------ .../test/test_bgp_tests_api_integration.py | 814 ++--- .../test_dns_server_tests_api_integration.py | 1233 ++++---- .../test_dns_trace_tests_api_integration.py | 985 +++--- .../test/test_dnssec_tests_api_integration.py | 975 +++--- .../test_ftp_server_tests_api_integration.py | 1230 ++++---- .../test_http_server_tests_api_integration.py | 1653 +++++----- .../test_page_load_tests_api_integration.py | 1753 ++++++----- ...zation_interface_groups_api_integration.py | 153 +- .../test_sip_server_tests_api_integration.py | 1220 ++++---- .../test/test_tests_api_integration.py | 198 +- .../test/test_voice_tests_api_integration.py | 1143 +++---- ...t_web_transaction_tests_api_integration.py | 1759 +++++------ .../test/test_quotas_api_integration.py | 153 +- .../test/test_usage_api_integration.py | 457 +-- 90 files changed, 33311 insertions(+), 27354 deletions(-) diff --git a/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py b/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py index 20d79a82..f30b9f77 100644 --- a/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py +++ b/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py @@ -40,68 +40,68 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] response_body_json = """ { - "isCurrentAccountGroup" : true, - "organizationName" : "organizationName", - "_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" + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" } }, - "accountGroupName" : "Account A", - "isDefaultAccountGroup" : true, - "aid" : "1234", - "orgId" : "12345", - "users" : [ { - "uid" : "235", - "lastLogin" : "2022-07-17T22:00:54Z", - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2022-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" }, { - "uid" : "235", - "lastLogin" : "2022-07-17T22:00:54Z", - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2022-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -118,7 +118,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -142,8 +141,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -160,7 +160,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -172,8 +171,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -190,7 +190,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -205,8 +204,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -223,7 +223,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -238,8 +237,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -256,7 +256,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -271,8 +270,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -289,7 +289,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -304,8 +303,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_account_group( + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("create_account_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -317,7 +317,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """Integration test for delete_account_group success path""" id = '1234' response = self.api.delete_account_group_with_http_info( + id=id, + _headers=self.te_headers("delete_account_group"), ) self.assertEqual(204, response.status_code) @@ -350,7 +352,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -370,7 +374,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -393,7 +399,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -416,7 +424,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -439,7 +449,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -462,7 +474,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_account_group( + id=id, + _headers=self.te_headers("delete_account_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -473,376 +487,376 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_happy_path(self) -> None: """Integration test for get_account_group success path""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] response_body_json = """ { - "isCurrentAccountGroup" : true, - "organizationName" : "organizationName", - "_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" + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" } }, - "accountGroupName" : "Account A", - "isDefaultAccountGroup" : true, - "accountToken" : "accountToken", - "aid" : "1234", - "orgId" : "12345", - "users" : [ { - "uid" : "235", - "lastLogin" : "2022-07-17T22:00:54Z", - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2022-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" }, { - "uid" : "235", - "lastLogin" : "2022-07-17T22:00:54Z", - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2022-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" } ], - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "ipv6Policy" : "force-ipv4", - "prefix" : "99.128.0.0/11", - "networkProviderInfo" : { - "asn" : 7018, - "name" : "AT&T Services, Inc.", - "type" : "isp" + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" }, - "countryId" : "US", - "enabled" : true, - "network" : "AT&T Services, Inc. (AS 7018)", - "hostname" : "thousandeyes.com", - "keepBrowserCache" : true, - "agentState" : "online", - "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], - "serialNumber" : "FOC2218ABCD", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "agentName" : "thousandeyes-stg-va-254", - "utilization" : 25, - "testIds" : [ 281474976710706 ], - "clusterMembers" : [ { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] }, { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] } ], - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" } ], - "lastSeen" : "2022-07-17T22:00:54Z", - "createdDate" : "2022-07-17T22:00:54Z", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "interfaceIpMapping" : [ { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" }, { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" } ], - "targetForTests" : "1.1.1.1", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "location" : "San Francisco Bay Area", - "accountGroups" : [ { - "accountGroupName" : "Account A", - "aid" : "1234" + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" }, { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroupName" : "Account A", + "aid" : "1234" } ], - "verifySslCertificates" : true, - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] }, { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "ipv6Policy" : "force-ipv4", - "prefix" : "99.128.0.0/11", - "networkProviderInfo" : { - "asn" : 7018, - "name" : "AT&T Services, Inc.", - "type" : "isp" + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" }, - "countryId" : "US", - "enabled" : true, - "network" : "AT&T Services, Inc. (AS 7018)", - "hostname" : "thousandeyes.com", - "keepBrowserCache" : true, - "agentState" : "online", - "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], - "serialNumber" : "FOC2218ABCD", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "agentName" : "thousandeyes-stg-va-254", - "utilization" : 25, - "testIds" : [ 281474976710706 ], - "clusterMembers" : [ { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] }, { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] } ], - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" } ], - "lastSeen" : "2022-07-17T22:00:54Z", - "createdDate" : "2022-07-17T22:00:54Z", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "interfaceIpMapping" : [ { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" }, { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" } ], - "targetForTests" : "1.1.1.1", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "location" : "San Francisco Bay Area", - "accountGroups" : [ { - "accountGroupName" : "Account A", - "aid" : "1234" + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" }, { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroupName" : "Account A", + "aid" : "1234" } ], - "verifySslCertificates" : true, - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -851,7 +865,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_error_400(self) -> None: """Integration test for get_account_group error path (HTTP 400)""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -875,8 +888,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -885,7 +899,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_error_401(self) -> None: """Integration test for get_account_group error path (HTTP 401)""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -897,8 +910,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -907,7 +921,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_error_403(self) -> None: """Integration test for get_account_group error path (HTTP 403)""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -922,8 +935,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -932,7 +946,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_error_404(self) -> None: """Integration test for get_account_group error path (HTTP 404)""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -947,8 +960,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -957,7 +971,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_error_429(self) -> None: """Integration test for get_account_group error path (HTTP 429)""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -972,8 +985,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -982,7 +996,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): def test_get_account_group_error_500(self) -> None: """Integration test for get_account_group error path (HTTP 500)""" id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -997,8 +1010,9 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_account_group( + id=id, - expand=expand, + _headers=self.te_headers("get_account_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1010,37 +1024,38 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """Integration test for get_account_groups success path""" 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" + "_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" } }, - "accountGroups" : [ { - "isCurrentAccountGroup" : true, - "organizationName" : "organizationName", - "accountGroupName" : "Account A", - "isDefaultAccountGroup" : true, - "aid" : "1234", - "orgId" : "12345" + "accountGroups" : [ { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" }, { - "isCurrentAccountGroup" : true, - "organizationName" : "organizationName", - "accountGroupName" : "Account A", - "isDefaultAccountGroup" : true, - "aid" : "1234", - "orgId" : "12345" + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_account_groups( + _headers=self.te_headers("get_account_groups"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1071,6 +1086,7 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_account_groups( + _headers=self.te_headers("get_account_groups", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1089,6 +1105,7 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_account_groups( + _headers=self.te_headers("get_account_groups", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1110,6 +1127,7 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_account_groups( + _headers=self.te_headers("get_account_groups", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1131,6 +1149,7 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_account_groups( + _headers=self.te_headers("get_account_groups", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1152,6 +1171,7 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_account_groups( + _headers=self.te_headers("get_account_groups", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1173,6 +1193,7 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_account_groups( + _headers=self.te_headers("get_account_groups", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1192,377 +1213,378 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] response_body_json = """ { - "isCurrentAccountGroup" : true, - "organizationName" : "organizationName", - "_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" + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_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" } }, - "accountGroupName" : "Account A", - "isDefaultAccountGroup" : true, - "accountToken" : "accountToken", - "aid" : "1234", - "orgId" : "12345", - "users" : [ { - "uid" : "235", - "lastLogin" : "2022-07-17T22:00:54Z", - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2022-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" }, { - "uid" : "235", - "lastLogin" : "2022-07-17T22:00:54Z", - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2022-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" } ], - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "ipv6Policy" : "force-ipv4", - "prefix" : "99.128.0.0/11", - "networkProviderInfo" : { - "asn" : 7018, - "name" : "AT&T Services, Inc.", - "type" : "isp" + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" }, - "countryId" : "US", - "enabled" : true, - "network" : "AT&T Services, Inc. (AS 7018)", - "hostname" : "thousandeyes.com", - "keepBrowserCache" : true, - "agentState" : "online", - "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], - "serialNumber" : "FOC2218ABCD", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "agentName" : "thousandeyes-stg-va-254", - "utilization" : 25, - "testIds" : [ 281474976710706 ], - "clusterMembers" : [ { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] }, { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] } ], - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" } ], - "lastSeen" : "2022-07-17T22:00:54Z", - "createdDate" : "2022-07-17T22:00:54Z", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "interfaceIpMapping" : [ { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" }, { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" } ], - "targetForTests" : "1.1.1.1", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "location" : "San Francisco Bay Area", - "accountGroups" : [ { - "accountGroupName" : "Account A", - "aid" : "1234" + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" }, { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroupName" : "Account A", + "aid" : "1234" } ], - "verifySslCertificates" : true, - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] }, { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "ipv6Policy" : "force-ipv4", - "prefix" : "99.128.0.0/11", - "networkProviderInfo" : { - "asn" : 7018, - "name" : "AT&T Services, Inc.", - "type" : "isp" + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" }, - "countryId" : "US", - "enabled" : true, - "network" : "AT&T Services, Inc. (AS 7018)", - "hostname" : "thousandeyes.com", - "keepBrowserCache" : true, - "agentState" : "online", - "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], - "serialNumber" : "FOC2218ABCD", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "agentName" : "thousandeyes-stg-va-254", - "utilization" : 25, - "testIds" : [ 281474976710706 ], - "clusterMembers" : [ { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] }, { - "lastSeen" : "2022-07-17T22:00:54Z", - "serialNumber" : "FOC2218ABCD", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "agentState" : "online", - "targetForTests" : "1.1.1.1", - "name" : "Cluster member name", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "utilization" : 25, - "network" : "AT&T Services, Inc. (AS 7018)", - "memberId" : "10", - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] } ], - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" } ], - "lastSeen" : "2022-07-17T22:00:54Z", - "createdDate" : "2022-07-17T22:00:54Z", - "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], - "interfaceIpMapping" : [ { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" }, { - "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], - "interfaceName" : "wlp4s0" + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" } ], - "targetForTests" : "1.1.1.1", - "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], - "location" : "San Francisco Bay Area", - "accountGroups" : [ { - "accountGroupName" : "Account A", - "aid" : "1234" + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" }, { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroupName" : "Account A", + "aid" : "1234" } ], - "verifySslCertificates" : true, - "errorDetails" : [ { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" }, { - "code" : "agent-version-outdated", - "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" } ] } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1580,7 +1602,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -1604,9 +1625,11 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1624,7 +1647,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1636,9 +1658,11 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1656,7 +1680,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -1671,9 +1694,11 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1691,7 +1716,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -1706,9 +1730,11 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1726,7 +1752,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -1741,9 +1766,11 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1761,7 +1788,6 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): """ account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json) id = '1234' - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] error_body_json = """ { "instance" : "instance", @@ -1776,9 +1802,11 @@ class TestAccountGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_account_group( + id=id, + account_group_request=account_group_request, - expand=expand, + _headers=self.te_headers("update_account_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py b/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py index 4d4d91c8..cb461ad6 100644 --- a/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py +++ b/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py @@ -34,34 +34,36 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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" + "_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" + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" }, { - "label" : "View snapshots", - "permissionId" : "51", - "isManagementPermission" : false, - "permission" : "REPORT_SNAPSHOTS_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) @@ -93,7 +95,9 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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) @@ -113,7 +117,9 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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) @@ -136,7 +142,9 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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) @@ -159,7 +167,9 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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) @@ -182,7 +192,9 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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) @@ -205,7 +217,9 @@ class TestPermissionsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-administrative/test/test_roles_api_integration.py b/thousandeyes-sdk-administrative/test/test_roles_api_integration.py index 5958f187..f79e5a8d 100644 --- a/thousandeyes-sdk-administrative/test/test_roles_api_integration.py +++ b/thousandeyes-sdk-administrative/test/test_roles_api_integration.py @@ -43,38 +43,41 @@ class TestRolesApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "roleId" : "35", - "permissions" : [ { - "label" : "View reports", - "permissionId" : "1", - "isManagementPermission" : true, - "permission" : "REPORT_READ" + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" }, { - "label" : "View snapshots", - "permissionId" : "51", - "isManagementPermission" : false, - "permission" : "REPORT_SNAPSHOTS_READ" + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" } ], - "name" : "Organization Admin", - "isBuiltin" : true + "name" : "Organization Admin", + "isBuiltin" : true } """ expected_response = json.loads(response_body_json) response = self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -115,8 +118,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -145,8 +151,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -178,8 +187,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -211,8 +223,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -244,8 +259,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -277,8 +295,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_role( + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("create_role", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -291,8 +312,11 @@ class TestRolesApiIntegration(IntegrationTestBase): id = '23' aid = '1234' response = self.api.delete_role_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_role"), ) self.assertEqual(204, response.status_code) @@ -326,8 +350,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -348,8 +375,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -373,8 +403,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -398,8 +431,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -423,8 +459,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -448,8 +487,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_role( + id=id, + aid=aid, + _headers=self.te_headers("delete_role", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -463,38 +505,41 @@ class TestRolesApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "roleId" : "35", - "permissions" : [ { - "label" : "View reports", - "permissionId" : "1", - "isManagementPermission" : true, - "permission" : "REPORT_READ" + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" }, { - "label" : "View snapshots", - "permissionId" : "51", - "isManagementPermission" : false, - "permission" : "REPORT_SNAPSHOTS_READ" + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" } ], - "name" : "Organization Admin", - "isBuiltin" : true + "name" : "Organization Admin", + "isBuiltin" : true } """ expected_response = json.loads(response_body_json) response = self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -527,8 +572,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -549,8 +597,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -574,8 +625,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -599,8 +653,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -624,8 +681,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -649,8 +709,11 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_role( + id=id, + aid=aid, + _headers=self.te_headers("get_role", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -663,34 +726,36 @@ class TestRolesApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -722,7 +787,9 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -742,7 +809,9 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -765,7 +834,9 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -788,7 +859,9 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -811,7 +884,9 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -834,7 +909,9 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_roles( + aid=aid, + _headers=self.te_headers("get_roles", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -857,39 +934,43 @@ class TestRolesApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "roleId" : "35", - "permissions" : [ { - "label" : "View reports", - "permissionId" : "1", - "isManagementPermission" : true, - "permission" : "REPORT_READ" + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" }, { - "label" : "View snapshots", - "permissionId" : "51", - "isManagementPermission" : false, - "permission" : "REPORT_SNAPSHOTS_READ" + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" } ], - "name" : "Organization Admin", - "isBuiltin" : true + "name" : "Organization Admin", + "isBuiltin" : true } """ expected_response = json.loads(response_body_json) response = self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -931,9 +1012,13 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -963,9 +1048,13 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -998,9 +1087,13 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1033,9 +1126,13 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1068,9 +1165,13 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1103,9 +1204,13 @@ class TestRolesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_role( + id=id, + role_request_body=role_request_body, + aid=aid, + _headers=self.te_headers("update_role", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py b/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py index e42f5677..908d363f 100644 --- a/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py +++ b/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py @@ -39,74 +39,81 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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" + "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" + "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)" + "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" + "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) @@ -143,12 +150,19 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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) @@ -173,12 +187,19 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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) @@ -206,12 +227,19 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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) @@ -239,12 +267,19 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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) @@ -272,12 +307,19 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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) @@ -305,12 +347,19 @@ class TestUserEventsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-administrative/test/test_users_api_integration.py b/thousandeyes-sdk-administrative/test/test_users_api_integration.py index 32d2afaf..c1a0b9d2 100644 --- a/thousandeyes-sdk-administrative/test/test_users_api_integration.py +++ b/thousandeyes-sdk-administrative/test/test_users_api_integration.py @@ -52,76 +52,79 @@ class TestUsersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "loginAccountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" }, - "uid" : "245", - "allAccountGroupRoles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "245", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + "_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" } }, - "accountGroupRoles" : [ { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } }, { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2020-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -171,8 +174,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -210,8 +216,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -252,8 +261,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -294,8 +306,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -336,8 +351,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -378,8 +396,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_user( + user_request=user_request, + aid=aid, + _headers=self.te_headers("create_user", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -392,8 +413,11 @@ class TestUsersApiIntegration(IntegrationTestBase): id = '1234' aid = '1234' response = self.api.delete_user_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_user"), ) self.assertEqual(204, response.status_code) @@ -427,8 +451,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -449,8 +476,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -474,8 +504,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -499,8 +532,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -524,8 +560,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -549,8 +588,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_user( + id=id, + aid=aid, + _headers=self.te_headers("delete_user", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -562,75 +604,76 @@ class TestUsersApiIntegration(IntegrationTestBase): """Integration test for get_current_user success path""" response_body_json = """ { - "loginAccountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" }, - "uid" : "245", - "lastLogin" : "2022-07-17T22:00:54Z", - "allAccountGroupRoles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + "_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" } }, - "accountGroupRoles" : [ { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } }, { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2020-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_current_user( + _headers=self.te_headers("get_current_user"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -661,6 +704,7 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_current_user( + _headers=self.te_headers("get_current_user", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -679,6 +723,7 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_current_user( + _headers=self.te_headers("get_current_user", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -700,6 +745,7 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_current_user( + _headers=self.te_headers("get_current_user", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -721,6 +767,7 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_current_user( + _headers=self.te_headers("get_current_user", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -742,6 +789,7 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_current_user( + _headers=self.te_headers("get_current_user", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -763,6 +811,7 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_current_user( + _headers=self.te_headers("get_current_user", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -776,77 +825,80 @@ class TestUsersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "loginAccountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" }, - "uid" : "245", - "lastLogin" : "2022-07-17T22:00:54Z", - "allAccountGroupRoles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + "_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" } }, - "accountGroupRoles" : [ { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } }, { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2020-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -879,8 +931,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -901,8 +956,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -926,8 +984,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -951,8 +1012,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -976,8 +1040,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1001,8 +1068,11 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_user( + id=id, + aid=aid, + _headers=self.te_headers("get_user", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1015,44 +1085,46 @@ class TestUsersApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "users" : [ { - "loginAccountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "users" : [ { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" }, - "uid" : "245", - "lastLogin" : "2022-07-17T22:00:54Z", - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2020-07-17T22:00:54Z" + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" }, { - "loginAccountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" }, - "uid" : "245", - "lastLogin" : "2022-07-17T22:00:54Z", - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2020-07-17T22:00:54Z" + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1084,7 +1156,9 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1104,7 +1178,9 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1127,7 +1203,9 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1150,7 +1228,9 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1173,7 +1253,9 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1196,7 +1278,9 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_users( + aid=aid, + _headers=self.te_headers("get_users", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1228,78 +1312,82 @@ class TestUsersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "loginAccountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" }, - "uid" : "245", - "lastLogin" : "2022-07-17T22:00:54Z", - "allAccountGroupRoles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : 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" + "_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" } }, - "accountGroupRoles" : [ { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } }, { - "roles" : [ { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true }, { - "roleId" : "35", - "name" : "Organization Admin", - "isBuiltin" : true, - "hasManagementPermissions" : true + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true } ], - "accountGroup" : { - "accountGroupName" : "Account A", - "aid" : "1234" + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" } } ], - "name" : "User X", - "email" : "userx@thousandeyes.com", - "dateRegistered" : "2020-07-17T22:00:54Z" + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1350,9 +1438,13 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1391,9 +1483,13 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1435,9 +1531,13 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1479,9 +1579,13 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1523,9 +1627,13 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1567,9 +1675,13 @@ class TestUsersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_user( + id=id, + user_request=user_request, + aid=aid, + _headers=self.te_headers("update_user", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py b/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py index 5c025461..c49fe42e 100644 --- a/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py +++ b/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py @@ -34,48 +34,50 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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" + "_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" + "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" + "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) @@ -95,7 +97,9 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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) @@ -118,7 +122,9 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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) @@ -141,7 +147,9 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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) @@ -164,7 +172,9 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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) @@ -187,7 +197,9 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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) @@ -210,7 +222,9 @@ class TestAgentProxiesApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py index a8d48b55..f3e5a4a0 100644 --- a/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py +++ b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py @@ -35,116 +35,119 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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" + "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" + "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" + "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" + "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" + "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." + "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 + "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" + "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 + "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 + "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" + "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 + "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) @@ -165,8 +168,11 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -190,8 +196,11 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -215,8 +224,11 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -240,8 +252,11 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -265,8 +280,11 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -290,8 +308,11 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -304,36 +325,38 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest aid = '1234' response_body_json = """ { - "agentAlertRules" : [ { - "ruleId" : "281474976710706", - "ruleName" : "Default Agent Offline Notification", - "expression" : "((lastContact >= 30 min))", - "notifyOnClear" : true, - "isDefault" : false + "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 + "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" + "_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) @@ -353,7 +376,9 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -376,7 +401,9 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -399,7 +426,9 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -422,7 +451,9 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -445,7 +476,9 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) @@ -468,7 +501,9 @@ class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTest 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) diff --git a/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py index f7ecdc5d..92c940db 100644 --- a/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py +++ b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py @@ -34,8 +34,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_id = '281474976710706' aid = '1234' response = self.api.delete_agent_with_http_info( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent"), ) self.assertEqual(204, response.status_code) @@ -57,8 +60,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -82,8 +88,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -107,8 +116,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -132,8 +144,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -157,8 +172,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -182,8 +200,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("delete_agent", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -195,127 +216,128 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent success path""" 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" + "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 + "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" + "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" + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" }, { - "labelId" : "11", - "name" : "Label name" + "labelId" : "11", + "name" : "Label name" } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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 + "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_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -325,7 +347,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent error path (HTTP 401)""" agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "error_description" : "Invalid access token", @@ -337,9 +358,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -349,7 +372,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent error path (HTTP 403)""" agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -364,9 +386,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -376,7 +400,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent error path (HTTP 404)""" agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -391,9 +414,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -403,7 +428,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent error path (HTTP 429)""" agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -418,9 +442,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -430,7 +456,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent error path (HTTP 500)""" agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -445,9 +470,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -457,7 +484,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): """Integration test for get_agent error path (HTTP 502)""" agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -472,9 +498,11 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_agent", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -485,76 +513,76 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_happy_path(self) -> None: """Integration test for get_agents success path""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] 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" + "_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 + "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" + "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 + "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 + "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" + "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 + "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( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -563,8 +591,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_error_401(self) -> None: """Integration test for get_agents error path (HTTP 401)""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] error_body_json = """ @@ -578,11 +604,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agents( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -591,8 +619,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_error_403(self) -> None: """Integration test for get_agents error path (HTTP 403)""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] error_body_json = """ @@ -609,11 +635,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agents( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -622,8 +650,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_error_404(self) -> None: """Integration test for get_agents error path (HTTP 404)""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] error_body_json = """ @@ -640,11 +666,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agents( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -653,8 +681,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_error_429(self) -> None: """Integration test for get_agents error path (HTTP 429)""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] error_body_json = """ @@ -671,11 +697,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agents( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -684,8 +712,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_error_500(self) -> None: """Integration test for get_agents error path (HTTP 500)""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] error_body_json = """ @@ -702,11 +728,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agents( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -715,8 +743,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): def test_get_agents_error_502(self) -> None: """Integration test for get_agents error path (HTTP 502)""" aid = '1234' - expand = [thousandeyes_sdk.agents.AgentListExpand()] - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] labels = ['[\"myCustomLabeledAgent\"]'] tag_keys = ['tag_keys_example'] error_body_json = """ @@ -733,11 +759,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agents( + aid=aid, - expand=expand, - agent_types=agent_types, + labels=labels, + tag_keys=tag_keys, + _headers=self.te_headers("get_agents", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -764,128 +792,130 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.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" + "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 + "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" + "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" + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" }, { - "labelId" : "11", - "name" : "Label name" + "labelId" : "11", + "name" : "Label name" } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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 + "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.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -910,7 +940,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -934,10 +963,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -962,7 +994,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "error_description" : "Invalid access token", @@ -974,10 +1005,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1002,7 +1036,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -1017,10 +1050,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1045,7 +1081,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -1060,10 +1095,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1088,7 +1126,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -1103,10 +1140,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1131,7 +1171,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -1146,10 +1185,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1174,7 +1216,6 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): agent_request = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json) agent_id = '281474976710706' aid = '1234' - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] error_body_json = """ { "instance" : "instance", @@ -1189,10 +1230,13 @@ class TestCloudAndEnterpriseAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_agent( + agent_id=agent_id, + agent_request=agent_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py b/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py index 424f1db2..b734cdc2 100644 --- a/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py +++ b/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py @@ -41,128 +41,130 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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" + "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 + "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" + "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" + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" }, { - "labelId" : "11", - "name" : "Label name" + "labelId" : "11", + "name" : "Label name" } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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 + "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) @@ -180,7 +182,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -204,10 +205,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -225,7 +229,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -237,10 +240,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -258,7 +264,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -273,10 +278,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -294,7 +302,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -309,10 +316,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -330,7 +340,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -345,10 +354,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -366,7 +378,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -381,10 +392,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -402,7 +416,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -417,10 +430,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -440,72 +456,74 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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" + "_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 + "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" + "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 + "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 + "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" + "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 + "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) @@ -523,7 +541,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -547,10 +564,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -568,7 +588,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -580,10 +599,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -601,7 +623,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -616,10 +637,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -637,7 +661,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -652,10 +675,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -673,7 +699,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -688,10 +713,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -709,7 +737,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -724,10 +751,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) @@ -745,7 +775,6 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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", @@ -760,10 +789,13 @@ class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py b/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py index d64ffb51..bd908a0b 100644 --- a/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py +++ b/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py @@ -37,51 +37,56 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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" + "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" + "endDate" : "2026-05-18T03:22:00Z", + "active" : false, + "startDate" : "2026-05-18T03:14:00Z" } ], - "startDate" : "2022-07-17T22:00:54Z" + "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) @@ -116,10 +121,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) @@ -142,10 +152,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) @@ -171,10 +186,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) @@ -200,10 +220,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) @@ -229,10 +254,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) @@ -258,10 +288,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) @@ -287,10 +322,15 @@ class TestLocalProblemsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py b/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py index c1f32dc9..d6898248 100644 --- a/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py +++ b/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py @@ -43,124 +43,128 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): aid = '1234' 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" + "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 + "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" + "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" + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" }, { - "labelId" : "11", - "name" : "Label name" + "labelId" : "11", + "name" : "Label name" } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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 + "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_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -201,9 +205,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -232,9 +240,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -266,9 +278,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -300,9 +316,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -334,9 +354,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -368,9 +392,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -402,9 +430,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.assign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("assign_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -426,124 +458,128 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): aid = '1234' 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" + "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 + "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" + "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" + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" }, { - "labelId" : "11", - "name" : "Label name" + "labelId" : "11", + "name" : "Label name" } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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 + "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.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -584,9 +620,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -615,9 +655,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -649,9 +693,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -683,9 +731,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -717,9 +769,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -751,9 +807,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -785,9 +845,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.overwrite_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("overwrite_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -809,124 +873,128 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): aid = '1234' 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" + "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 + "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" + "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" + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" }, { - "labelId" : "11", - "name" : "Label name" + "labelId" : "11", + "name" : "Label name" } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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 + "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_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -967,9 +1035,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -998,9 +1070,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1032,9 +1108,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1066,9 +1146,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1100,9 +1184,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1134,9 +1222,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1168,9 +1260,13 @@ class TestTestsAssignmentOnAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.unassign_tests( + agent_id=agent_id, + agent_tests_assign_request=agent_tests_assign_request, + aid=aid, + _headers=self.te_headers("unassign_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py b/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py index dd34a8cc..5e96180d 100644 --- a/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py +++ b/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py @@ -97,80 +97,83 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "_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" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" } }, - "includeCoveredPrefixes" : true, - "visitedSitesFilter" : [ "app.thousandeyes.com" ], - "description" : "A rule description string", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "alertGroupType" : "endpoint", - "notifyOnClear" : true, - "testIds" : [ "281474976710706", "271659" ], - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "endpointAgentIds" : [ "281474976710706", "281474976710706" ], - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "endpointLabelIds" : [ "123456", "123456" ], - "minimumSources" : 10, - "ruleId" : "127094", - "notifications" : { - "thirdParty" : [ { - "integrationType" : "slack", - "integrationId" : "sl-101" + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" }, { - "integrationType" : "slack", - "integrationId" : "sl-101" + "integrationType" : "slack", + "integrationId" : "sl-101" } ], - "webhook" : [ { - "integrationType" : "webhook", - "integrationName" : "My webhook", - "integrationId" : "wb-201", - "target" : "https://example.com/test/webhooks/notifications" + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" }, { - "integrationType" : "webhook", - "integrationName" : "My webhook", - "integrationId" : "wb-201", - "target" : "https://example.com/test/webhooks/notifications" + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" } ], - "email" : { - "recipients" : [ "noreply@thousandeyes.com" ], - "message" : "Notification message" + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" }, - "customWebhook" : [ { - "integrationType" : "custom-webhook", - "integrationName" : "My webhook", - "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", - "target" : "https://example.com/test/webhooks/notifications" + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" }, { - "integrationType" : "custom-webhook", - "integrationName" : "My webhook", - "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", - "target" : "https://example.com/test/webhooks/notifications" + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" } ] }, - "direction" : "to-target" + "direction" : "to-target" } """ expected_response = json.loads(response_body_json) response = self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -265,8 +268,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -349,8 +355,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -436,8 +445,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -523,8 +535,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -610,8 +625,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -697,8 +715,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_alert_rule( + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("create_alert_rule", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -711,8 +732,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): rule_id = '127094' aid = '1234' response = self.api.delete_alert_rule_with_http_info( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule"), ) self.assertEqual(204, response.status_code) @@ -746,8 +770,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -768,8 +795,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -793,8 +823,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -818,8 +851,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -843,8 +879,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -868,8 +907,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("delete_alert_rule", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -883,143 +925,146 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "_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" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" } }, - "includeCoveredPrefixes" : true, - "visitedSitesFilter" : [ "app.thousandeyes.com" ], - "description" : "A rule description string", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "alertGroupType" : "endpoint", - "notifyOnClear" : true, - "testIds" : [ "281474976710706", "271659" ], - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "endpointAgentIds" : [ "281474976710706", "281474976710706" ], - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" } ], - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "endpointLabelIds" : [ "123456", "123456" ], - "minimumSources" : 10, - "ruleId" : "127094", - "notifications" : { - "thirdParty" : [ { - "integrationType" : "slack", - "integrationId" : "sl-101" + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" }, { - "integrationType" : "slack", - "integrationId" : "sl-101" + "integrationType" : "slack", + "integrationId" : "sl-101" } ], - "webhook" : [ { - "integrationType" : "webhook", - "integrationName" : "My webhook", - "integrationId" : "wb-201", - "target" : "https://example.com/test/webhooks/notifications" + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" }, { - "integrationType" : "webhook", - "integrationName" : "My webhook", - "integrationId" : "wb-201", - "target" : "https://example.com/test/webhooks/notifications" + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" } ], - "email" : { - "recipients" : [ "noreply@thousandeyes.com" ], - "message" : "Notification message" + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" }, - "customWebhook" : [ { - "integrationType" : "custom-webhook", - "integrationName" : "My webhook", - "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", - "target" : "https://example.com/test/webhooks/notifications" + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" }, { - "integrationType" : "custom-webhook", - "integrationName" : "My webhook", - "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", - "target" : "https://example.com/test/webhooks/notifications" + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" } ] }, - "direction" : "to-target" + "direction" : "to-target" } """ expected_response = json.loads(response_body_json) response = self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1040,8 +1085,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1065,8 +1113,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1090,8 +1141,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1115,8 +1169,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1140,8 +1197,11 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_alert_rule( + rule_id=rule_id, + aid=aid, + _headers=self.te_headers("get_alert_rule", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1154,66 +1214,68 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "includeCoveredPrefixes" : true, - "visitedSitesFilter" : [ "app.thousandeyes.com" ], - "description" : "A rule description string", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "alertGroupType" : "endpoint", - "notifyOnClear" : true, - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "endpointAgentIds" : [ "281474976710706", "281474976710706" ], - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "endpointLabelIds" : [ "123456", "123456" ], - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "includeCoveredPrefixes" : true, - "visitedSitesFilter" : [ "app.thousandeyes.com" ], - "description" : "A rule description string", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "alertGroupType" : "endpoint", - "notifyOnClear" : true, - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "endpointAgentIds" : [ "281474976710706", "281474976710706" ], - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "endpointLabelIds" : [ "123456", "123456" ], - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1233,7 +1295,9 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1256,7 +1320,9 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1279,7 +1345,9 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1302,7 +1370,9 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1325,7 +1395,9 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_alerts_rules( + aid=aid, + _headers=self.te_headers("get_alerts_rules", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1402,81 +1474,85 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "_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" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_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" } }, - "includeCoveredPrefixes" : true, - "visitedSitesFilter" : [ "app.thousandeyes.com" ], - "description" : "A rule description string", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "alertGroupType" : "endpoint", - "notifyOnClear" : true, - "testIds" : [ "281474976710706", "271659" ], - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "endpointAgentIds" : [ "281474976710706", "281474976710706" ], - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "endpointLabelIds" : [ "123456", "123456" ], - "minimumSources" : 10, - "ruleId" : "127094", - "notifications" : { - "thirdParty" : [ { - "integrationType" : "slack", - "integrationId" : "sl-101" + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" }, { - "integrationType" : "slack", - "integrationId" : "sl-101" + "integrationType" : "slack", + "integrationId" : "sl-101" } ], - "webhook" : [ { - "integrationType" : "webhook", - "integrationName" : "My webhook", - "integrationId" : "wb-201", - "target" : "https://example.com/test/webhooks/notifications" + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" }, { - "integrationType" : "webhook", - "integrationName" : "My webhook", - "integrationId" : "wb-201", - "target" : "https://example.com/test/webhooks/notifications" + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" } ], - "email" : { - "recipients" : [ "noreply@thousandeyes.com" ], - "message" : "Notification message" + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" }, - "customWebhook" : [ { - "integrationType" : "custom-webhook", - "integrationName" : "My webhook", - "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", - "target" : "https://example.com/test/webhooks/notifications" + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" }, { - "integrationType" : "custom-webhook", - "integrationName" : "My webhook", - "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", - "target" : "https://example.com/test/webhooks/notifications" + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" } ] }, - "direction" : "to-target" + "direction" : "to-target" } """ expected_response = json.loads(response_body_json) response = self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1572,9 +1648,13 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1658,9 +1738,13 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1747,9 +1831,13 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1836,9 +1924,13 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1925,9 +2017,13 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2014,9 +2110,13 @@ class TestAlertRulesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_alert_rule( + rule_id=rule_id, + rule_detail_update=rule_detail_update, + aid=aid, + _headers=self.te_headers("update_alert_rule", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py b/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py index aac6b9f7..382665c5 100644 --- a/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py +++ b/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py @@ -57,108 +57,109 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] response_body_json = """ { - "duration" : 0, - "alertSuppressionWindowId" : "2411", - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" } }, - "isEnabled" : false, - "repeat" : { - "intervalType" : "day", - "intervalLength" : 2, - "type" : "week", - "daysOfWeek" : [ "sun", "sun" ] + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] }, - "endRepeat" : { - "date" : "2017-07-01", - "count" : 3, - "type" : "never" + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" }, - "name" : "Monthly maintenance", - "startDate" : "2017-07-01T05:00:00Z", - "status" : "ended" + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" } """ expected_response = json.loads(response_body_json) response = self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -192,7 +193,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -216,9 +216,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -252,7 +254,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -264,9 +265,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -300,7 +303,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -315,9 +317,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -351,7 +355,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -366,9 +369,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -402,7 +407,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -417,9 +421,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -453,7 +459,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """ alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -468,9 +473,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_alert_suppression_window( + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_alert_suppression_window", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -483,8 +490,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): window_id = '2411' aid = '1234' response = self.api.delete_alert_suppression_window_with_http_info( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window"), ) self.assertEqual(204, response.status_code) @@ -518,8 +528,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -540,8 +553,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -565,8 +581,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -590,8 +609,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -615,8 +637,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -640,8 +665,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_alert_suppression_window( + window_id=window_id, + aid=aid, + _headers=self.te_headers("delete_alert_suppression_window", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -653,108 +681,109 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """Integration test for get_alert_suppression_window success path""" window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] response_body_json = """ { - "duration" : 0, - "alertSuppressionWindowId" : "2411", - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" } }, - "isEnabled" : false, - "repeat" : { - "intervalType" : "day", - "intervalLength" : 2, - "type" : "week", - "daysOfWeek" : [ "sun", "sun" ] + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] }, - "endRepeat" : { - "date" : "2017-07-01", - "count" : 3, - "type" : "never" + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" }, - "name" : "Monthly maintenance", - "startDate" : "2017-07-01T05:00:00Z", - "status" : "ended" + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" } """ expected_response = json.loads(response_body_json) response = self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_alert_suppression_window"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -764,7 +793,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """Integration test for get_alert_suppression_window error path (HTTP 401)""" window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -776,9 +804,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -788,7 +818,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """Integration test for get_alert_suppression_window error path (HTTP 403)""" window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -803,9 +832,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -815,7 +846,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """Integration test for get_alert_suppression_window error path (HTTP 404)""" window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -830,9 +860,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -842,7 +874,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """Integration test for get_alert_suppression_window error path (HTTP 429)""" window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -857,9 +888,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -869,7 +902,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): """Integration test for get_alert_suppression_window error path (HTTP 500)""" window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -884,9 +916,11 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_alert_suppression_window( + window_id=window_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_alert_suppression_window", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -899,84 +933,86 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "alertSuppressionWindows" : [ { - "duration" : 0, - "alertSuppressionWindowId" : "2411", - "_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" + "alertSuppressionWindows" : [ { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_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" } }, - "isEnabled" : false, - "repeat" : { - "intervalType" : "day", - "intervalLength" : 2, - "type" : "week", - "daysOfWeek" : [ "sun", "sun" ] + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] }, - "endRepeat" : { - "date" : "2017-07-01", - "count" : 3, - "type" : "never" + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" }, - "name" : "Monthly maintenance", - "startDate" : "2017-07-01T05:00:00Z", - "status" : "ended" + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" }, { - "duration" : 0, - "alertSuppressionWindowId" : "2411", - "_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" + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_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" } }, - "isEnabled" : false, - "repeat" : { - "intervalType" : "day", - "intervalLength" : 2, - "type" : "week", - "daysOfWeek" : [ "sun", "sun" ] + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] }, - "endRepeat" : { - "date" : "2017-07-01", - "count" : 3, - "type" : "never" + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" }, - "name" : "Monthly maintenance", - "startDate" : "2017-07-01T05:00:00Z", - "status" : "ended" + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -996,7 +1032,9 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1019,7 +1057,9 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1042,7 +1082,9 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1065,7 +1107,9 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1088,7 +1132,9 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_alert_suppression_windows( + aid=aid, + _headers=self.te_headers("get_alert_suppression_windows", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1125,109 +1171,111 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] response_body_json = """ { - "duration" : 0, - "alertSuppressionWindowId" : "2411", - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" } }, - "isEnabled" : false, - "repeat" : { - "intervalType" : "day", - "intervalLength" : 2, - "type" : "week", - "daysOfWeek" : [ "sun", "sun" ] + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] }, - "endRepeat" : { - "date" : "2017-07-01", - "count" : 3, - "type" : "never" + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" }, - "name" : "Monthly maintenance", - "startDate" : "2017-07-01T05:00:00Z", - "status" : "ended" + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" } """ expected_response = json.loads(response_body_json) response = self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1262,7 +1310,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1286,10 +1333,13 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1324,7 +1374,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1336,10 +1385,13 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1374,7 +1426,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1389,10 +1440,13 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1427,7 +1481,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1442,10 +1495,13 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1480,7 +1536,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1495,10 +1550,13 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1533,7 +1591,6 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json) window_id = '2411' aid = '1234' - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1548,10 +1605,13 @@ class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_alert_suppression_window( + window_id=window_id, + alert_suppression_window_request=alert_suppression_window_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_alert_suppression_window", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py b/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py index 4632a7a8..7d0bc39d 100644 --- a/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py +++ b/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py @@ -35,98 +35,101 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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" + "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" + "alertSeverity" : "major", + "duration" : 60, + "violationCount" : 2, + "_embedded" : { + "asn" : { + "name" : "Cisco Webex LLC", + "id" : "13445", + "type" : "asn" } }, - "meta" : { - "version" : 1 + "meta" : { + "version" : 1 }, - "details" : [ { - "name" : "Bucharest, Romania", - "start" : { - "metrics" : "metrics" + "details" : [ { + "name" : "Bucharest, Romania", + "start" : { + "metrics" : "metrics" }, - "end" : { - "metrics" : "metrics" + "end" : { + "metrics" : "metrics" }, - "id" : "3379", - "state" : "trigger", - "type" : "cea_agent" + "id" : "3379", + "state" : "trigger", + "type" : "cea_agent" }, { - "name" : "Bucharest, Romania", - "start" : { - "metrics" : "metrics" + "name" : "Bucharest, Romania", + "start" : { + "metrics" : "metrics" }, - "end" : { - "metrics" : "metrics" + "end" : { + "metrics" : "metrics" }, - "id" : "3379", - "state" : "trigger", - "type" : "cea_agent" + "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" + "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) @@ -147,8 +150,11 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -172,8 +178,11 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -197,8 +206,11 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -222,8 +234,11 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -247,8 +262,11 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -264,189 +282,194 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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" + "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" : "" + "apiLinks" : [ { + "key" : "" }, { - "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 + "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" + "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" + "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" + "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" + "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" + "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" : "" + "apiLinks" : [ { + "key" : "" }, { - "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 + "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" + "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" + "_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" + "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" + "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) @@ -460,7 +483,6 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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", @@ -472,13 +494,19 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -492,7 +520,6 @@ class TestAlertsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - state = thousandeyes_sdk.alerts.State() error_body_json = """ { "instance" : "instance", @@ -507,13 +534,19 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -527,7 +560,6 @@ class TestAlertsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - state = thousandeyes_sdk.alerts.State() error_body_json = """ { "instance" : "instance", @@ -542,13 +574,19 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -562,7 +600,6 @@ class TestAlertsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - state = thousandeyes_sdk.alerts.State() error_body_json = """ { "instance" : "instance", @@ -577,13 +614,19 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) @@ -597,7 +640,6 @@ class TestAlertsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - state = thousandeyes_sdk.alerts.State() error_body_json = """ { "instance" : "instance", @@ -612,13 +654,19 @@ class TestAlertsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py index 652ff738..c487bb72 100644 --- a/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py +++ b/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py @@ -66,37 +66,40 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): 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" + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "webhook", - "secrets" : [ { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" }, { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" } ], - "status" : "pending" + "status" : "pending" } """ expected_response = json.loads(response_body_json) response = self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -160,8 +163,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -213,8 +219,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -269,8 +278,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -325,8 +337,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -381,8 +396,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_credential_vault_operation( + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("create_credential_vault_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -396,9 +414,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): confirm_disabled_objects = False aid = '1234' response = self.api.delete_credential_vault_operation_with_http_info( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation"), ) self.assertEqual(204, response.status_code) @@ -433,9 +455,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -457,9 +483,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -484,9 +514,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -511,9 +545,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -538,9 +576,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_credential_vault_operation( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_credential_vault_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -554,37 +596,40 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): 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" + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "webhook", - "secrets" : [ { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" }, { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" } ], - "status" : "pending" + "status" : "pending" } """ expected_response = json.loads(response_body_json) response = self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -617,8 +662,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -639,8 +687,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -664,8 +715,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -689,8 +743,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -714,8 +771,11 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_credential_vault_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_credential_vault_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -728,76 +788,78 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): 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" + "_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" : [ { - "_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" : [ { + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "webhook", - "secrets" : [ { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" }, { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" } ], - "status" : "pending" + "status" : "pending" }, { - "_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" + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "webhook", - "secrets" : [ { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" }, { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" } ], - "status" : "pending" + "status" : "pending" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -829,7 +891,9 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -849,7 +913,9 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -872,7 +938,9 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -895,7 +963,9 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -918,7 +988,9 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_credential_vault_operations( + aid=aid, + _headers=self.te_headers("get_credential_vault_operations", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -964,38 +1036,42 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): 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" + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "webhook", - "secrets" : [ { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" }, { - "secretKey" : "secret/key", - "name" : "secret_name", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" } ], - "status" : "pending" + "status" : "pending" } """ expected_response = json.loads(response_body_json) response = self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1060,9 +1136,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1115,9 +1195,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1173,9 +1257,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1231,9 +1319,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1289,9 +1381,13 @@ class TestCredentialVaultOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_credential_vault_operation( + id=id, + credential_vault_operation=credential_vault_operation, + aid=aid, + _headers=self.te_headers("update_credential_vault_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py index d46700da..fd05aef0 100644 --- a/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py +++ b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py @@ -64,35 +64,38 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "account" : "My CyberArk Account", - "target" : "https://eval.conjur.org/secrets", - "authentication" : { - "apiKey" : "abc123", - "hostId" : "host1", - "type" : "basic" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" } } """ expected_response = json.loads(response_body_json) response = self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -154,8 +157,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -205,8 +211,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -259,8 +268,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -313,8 +325,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -367,8 +382,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_conjur_connector( + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("create_conjur_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -382,9 +400,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): confirm_disabled_objects = False aid = '1234' response = self.api.delete_conjur_connector_with_http_info( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector"), ) self.assertEqual(204, response.status_code) @@ -419,9 +441,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -443,9 +469,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -470,9 +500,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -497,9 +531,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -524,9 +562,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_conjur_connector( + id=id, + confirm_disabled_objects=confirm_disabled_objects, + aid=aid, + _headers=self.te_headers("delete_conjur_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -540,35 +582,38 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "account" : "My CyberArk Account", - "target" : "https://eval.conjur.org/secrets", - "authentication" : { - "apiKey" : "abc123", - "hostId" : "host1", - "type" : "basic" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" } } """ expected_response = json.loads(response_body_json) response = self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -601,8 +646,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -623,8 +671,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -648,8 +699,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -673,8 +727,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -698,8 +755,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_conjur_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -713,25 +773,28 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): 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" + "_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" ] + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] } """ expected_response = json.loads(response_body_json) response = self.api.get_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -764,8 +827,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -786,8 +852,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -811,8 +880,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -836,8 +908,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -861,8 +936,11 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_conjur_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("get_conjur_connector_operations", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -875,72 +953,74 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): 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" + "_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" : [ { - "lastModifiedDate" : 1770293655756, - "_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" : [ { + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "account" : "My CyberArk Account", - "target" : "https://eval.conjur.org/secrets", - "authentication" : { - "apiKey" : "abc123", - "hostId" : "host1", - "type" : "basic" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" } }, { - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "account" : "My CyberArk Account", - "target" : "https://eval.conjur.org/secrets", - "authentication" : { - "apiKey" : "abc123", - "hostId" : "host1", - "type" : "basic" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" } } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -972,7 +1052,9 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -992,7 +1074,9 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1015,7 +1099,9 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1038,7 +1124,9 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1061,7 +1149,9 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_conjur_connectors( + aid=aid, + _headers=self.te_headers("get_conjur_connectors", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1105,36 +1195,40 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "account" : "My CyberArk Account", - "target" : "https://eval.conjur.org/secrets", - "authentication" : { - "apiKey" : "abc123", - "hostId" : "host1", - "type" : "basic" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" } } """ expected_response = json.loads(response_body_json) response = self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1197,9 +1291,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1250,9 +1348,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1306,9 +1408,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1362,9 +1468,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1418,9 +1528,13 @@ class TestCyberArkConjurConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_conjur_connector( + id=id, + conjur_connector=conjur_connector, + aid=aid, + _headers=self.te_headers("update_conjur_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py index 036a1f08..77671948 100644 --- a/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py +++ b/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py @@ -70,41 +70,44 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "target" : "https://hooks.slack.com/services/abc/xyz", - "authentication" : { - "password" : "abc123", - "type" : "basic", - "username" : "user1" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" } } """ expected_response = json.loads(response_body_json) response = self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -172,8 +175,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -229,8 +235,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -289,8 +298,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -349,8 +361,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -409,8 +424,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_generic_connector( + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("create_generic_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -423,8 +441,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' aid = '1234' response = self.api.delete_generic_connector_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector"), ) self.assertEqual(204, response.status_code) @@ -458,8 +479,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -480,8 +504,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -505,8 +532,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -530,8 +560,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -555,8 +588,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("delete_generic_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -570,41 +606,44 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "target" : "https://hooks.slack.com/services/abc/xyz", - "authentication" : { - "password" : "abc123", - "type" : "basic", - "username" : "user1" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" } } """ expected_response = json.loads(response_body_json) response = self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -637,8 +676,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -659,8 +701,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -684,8 +729,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -709,8 +757,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -734,8 +785,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_generic_connector( + id=id, + aid=aid, + _headers=self.te_headers("get_generic_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -748,84 +802,86 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): 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" + "_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" : [ { - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "items" : [ { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "target" : "https://hooks.slack.com/services/abc/xyz", - "authentication" : { - "password" : "abc123", - "type" : "basic", - "username" : "user1" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" } }, { - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "target" : "https://hooks.slack.com/services/abc/xyz", - "authentication" : { - "password" : "abc123", - "type" : "basic", - "username" : "user1" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" } } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -857,7 +913,9 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -877,7 +935,9 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -900,7 +960,9 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -923,7 +985,9 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -946,7 +1010,9 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_generic_connectors( + aid=aid, + _headers=self.te_headers("get_generic_connectors", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -960,25 +1026,28 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): 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" + "_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" ] + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] } """ expected_response = json.loads(response_body_json) response = self.api.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1011,8 +1080,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1033,8 +1105,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1058,8 +1133,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1083,8 +1161,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1108,8 +1189,11 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.list_generic_connector_operations( + id=id, + aid=aid, + _headers=self.te_headers("list_generic_connector_operations", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1159,42 +1243,46 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "lastModifiedDate" : 1770293655756, - "_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" + "lastModifiedDate" : 1770293655756, + "_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" : "Cisco Slack", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "type" : "generic", - "target" : "https://hooks.slack.com/services/abc/xyz", - "authentication" : { - "password" : "abc123", - "type" : "basic", - "username" : "user1" + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" } } """ expected_response = json.loads(response_body_json) response = self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1263,9 +1351,13 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1322,9 +1414,13 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1384,9 +1480,13 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1446,9 +1546,13 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1508,9 +1612,13 @@ class TestGenericConnectorsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_generic_connector( + id=id, + generic_connector=generic_connector, + aid=aid, + _headers=self.te_headers("update_generic_connector", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py index 2ab44d8a..3a3e2f1a 100644 --- a/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py +++ b/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py @@ -36,26 +36,30 @@ class TestOperationConnectorsApiIntegration(IntegrationTestBase): 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" + "_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" ] + "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) @@ -89,9 +93,13 @@ class TestOperationConnectorsApiIntegration(IntegrationTestBase): 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) @@ -113,9 +121,13 @@ class TestOperationConnectorsApiIntegration(IntegrationTestBase): 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) @@ -140,9 +152,13 @@ class TestOperationConnectorsApiIntegration(IntegrationTestBase): 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) @@ -167,9 +183,13 @@ class TestOperationConnectorsApiIntegration(IntegrationTestBase): 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) @@ -194,9 +214,13 @@ class TestOperationConnectorsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py index e2be8479..4233aae4 100644 --- a/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py +++ b/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py @@ -69,40 +69,43 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "path" : "/custom/path", - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", - "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", - "_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" + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "category" : "alerts", - "type" : "webhook", - "enabled" : true, - "status" : "pending" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" } """ expected_response = json.loads(response_body_json) response = self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -169,8 +172,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -225,8 +231,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -284,8 +293,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -343,8 +355,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -402,8 +417,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_webhook_operation( + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("create_webhook_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -416,8 +434,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' aid = '1234' response = self.api.delete_webhook_operation_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation"), ) self.assertEqual(204, response.status_code) @@ -451,8 +472,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -473,8 +497,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -498,8 +525,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -523,8 +553,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -548,8 +581,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("delete_webhook_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -563,40 +599,43 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "path" : "/custom/path", - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", - "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", - "_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" + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "category" : "alerts", - "type" : "webhook", - "enabled" : true, - "status" : "pending" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" } """ expected_response = json.loads(response_body_json) response = self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -629,8 +668,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -651,8 +693,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -676,8 +721,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -701,8 +749,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -726,8 +777,11 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_webhook_operation( + id=id, + aid=aid, + _headers=self.te_headers("get_webhook_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -740,82 +794,84 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): 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" + "_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" : [ { - "path" : "/custom/path", - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "items" : [ { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", - "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", - "_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" + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "category" : "alerts", - "type" : "webhook", - "enabled" : true, - "status" : "pending" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" }, { - "path" : "/custom/path", - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", - "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", - "_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" + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "category" : "alerts", - "type" : "webhook", - "enabled" : true, - "status" : "pending" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -847,7 +903,9 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -867,7 +925,9 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -890,7 +950,9 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -913,7 +975,9 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -936,7 +1000,9 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_webhook_operations( + aid=aid, + _headers=self.te_headers("get_webhook_operations", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -985,41 +1051,45 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "path" : "/custom/path", - "headers" : [ { - "name" : "Content-Type", - "value" : "application/json" + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" }, { - "name" : "Content-Type", - "value" : "application/json" + "name" : "Content-Type", + "value" : "application/json" } ], - "payload" : "{\"property1\": {{numericVar}}, \"property2\": \"{{stringVar}}\"}", - "queryParams" : "{\"queryParam1\":\"{{stringVar}}\"}", - "_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" + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_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" : "My operation", - "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", - "category" : "alerts", - "type" : "webhook", - "enabled" : true, - "status" : "pending" + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" } """ expected_response = json.loads(response_body_json) response = self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1087,9 +1157,13 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1145,9 +1219,13 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1206,9 +1284,13 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1267,9 +1349,13 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1328,9 +1414,13 @@ class TestWebhookOperationsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_webhook_operation( + id=id, + webhook_operation=webhook_operation, + aid=aid, + _headers=self.te_headers("update_webhook_operation", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py b/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py index a3a421dd..2642639c 100644 --- a/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py +++ b/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py @@ -43,26 +43,29 @@ class TestCredentialsApiIntegration(IntegrationTestBase): 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" + "_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" + "name" : "Example Credential", + "id" : "3247" } """ expected_response = json.loads(response_body_json) response = self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -103,8 +106,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -133,8 +139,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -166,8 +175,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -199,8 +211,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -232,8 +247,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -265,8 +283,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_credential( + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("create_credential", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -279,8 +300,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): id = '3247' aid = '1234' response = self.api.delete_credential_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential"), ) self.assertEqual(204, response.status_code) @@ -302,8 +326,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -327,8 +354,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -352,8 +382,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -377,8 +410,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -402,8 +438,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_credential( + id=id, + aid=aid, + _headers=self.te_headers("delete_credential", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -417,27 +456,30 @@ class TestCredentialsApiIntegration(IntegrationTestBase): 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" + "_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" + "name" : "Example Credential", + "id" : "3247", + "value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt" } """ expected_response = json.loads(response_body_json) response = self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -470,8 +512,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -492,8 +537,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -517,8 +565,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -542,8 +593,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -567,8 +621,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -592,8 +649,11 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_credential( + id=id, + aid=aid, + _headers=self.te_headers("get_credential", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -606,56 +666,58 @@ class TestCredentialsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "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" + "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" + "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" + "_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" + "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" + "_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_credentials( + aid=aid, + _headers=self.te_headers("get_credentials"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -675,7 +737,9 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -698,7 +762,9 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -721,7 +787,9 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -744,7 +812,9 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -767,7 +837,9 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_credentials( + aid=aid, + _headers=self.te_headers("get_credentials", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -790,27 +862,31 @@ class TestCredentialsApiIntegration(IntegrationTestBase): 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" + "_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" + "name" : "Example Credential", + "id" : "3247" } """ expected_response = json.loads(response_body_json) response = self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -852,9 +928,13 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -884,9 +964,13 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -919,9 +1003,13 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -954,9 +1042,13 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -989,9 +1081,13 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1024,9 +1120,13 @@ class TestCredentialsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_credential( + id=id, + credential_request=credential_request, + aid=aid, + _headers=self.te_headers("update_credential", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py index 0f1393de..6ae79e8c 100644 --- a/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py +++ b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py @@ -48,25 +48,28 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "_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" + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -112,8 +115,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -147,8 +153,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -185,8 +194,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -223,8 +235,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -261,8 +276,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_dashboard_snapshot( + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + aid=aid, + _headers=self.te_headers("create_dashboard_snapshot", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -275,8 +293,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' aid = '1234' response = self.api.delete_dashboard_snapshot_with_http_info( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot"), ) self.assertEqual(204, response.status_code) @@ -310,8 +331,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -332,8 +356,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -357,8 +384,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -382,8 +412,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -407,8 +440,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -432,8 +468,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("delete_dashboard_snapshot", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -447,275 +486,278 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "_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" + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" }, - "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" + "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" : "" + "apiLinks" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "snapshotExpirationDate" : "2023-05-16T10:14:28Z", - "isScheduled" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "accountId" : 1234, - "createdDate" : "2023-05-16 10:14:28", - "snapshotName" : "HTTP Server Dashboard Snapshot", - "timeSpan" : { - "duration" : 60, - "start" : "2023-05-16T10:14:28Z", - "startDate" : "2023-05-16 10:14:28" + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" }, - "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "aid" : "1234", - "snapshotCreatedDate" : "2023-05-16T10:14:28Z", - "isShared" : true, - "dashboard" : { - "isMigratedReport" : false, - "dashboardCreatedBy" : "1", - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "modifiedBy" : 1, - "dashboardModifiedBy" : "1", - "migratedReport" : false, - "isDefaultForAccount" : false, - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "accountId" : 1234, - "apiLink" : [ { - "key" : "" + "accountId" : 1234, + "apiLink" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : 1, - "globalOverride" : true, - "modifiedDate" : "2023-05-16 10:14:28", - "isGlobalOverride" : true, - "aid" : "1234", - "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" }, - "expirationDate" : "2023-05-16 10:14:28" + "expirationDate" : "2023-05-16 10:14:28" } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -748,8 +790,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -770,8 +815,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -795,8 +843,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -820,8 +871,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -845,8 +899,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -870,8 +927,11 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboard_snapshot( + snapshot_id=snapshot_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -886,411 +946,415 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "groupLabels" : [ { - "groupProperty" : "AGENT", - "groupLabels" : [ { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" }, { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" } ] }, { - "groupProperty" : "AGENT", - "groupLabels" : [ { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" }, { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" } ] } ], - "data" : { - "alerts" : [ { - "alertType" : "network-end-to-end-server", - "durationInSeconds" : 25, - "alertSource" : "Http Test", - "active" : true, - "testId" : "56512", - "startTime" : "2023-06-02T08:54:00Z", - "alertId" : "2004945", - "ruleId" : "281724", - "alertRule" : "Http Test Rule" + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" }, { - "alertType" : "network-end-to-end-server", - "durationInSeconds" : 25, - "alertSource" : "Http Test", - "active" : true, - "testId" : "56512", - "startTime" : "2023-06-02T08:54:00Z", - "alertId" : "2004945", - "ruleId" : "281724", - "alertRule" : "Http Test Rule" + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" } ], - "summary" : { - "offline" : 2, - "online" : 10, - "disabled" : 3 + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 }, - "totalAlerts" : 500, - "cards" : [ { - "numberOfDataPoints" : 24192, - "cardName" : "Card Name", - "endDate" : "2023-05-16T10:14:28Z", - "_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" + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" } }, - "cardId" : "lrxxr", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "previousValue" : 500, - "value" : 100, - "startDate" : "2023-05-16T10:14:28Z", - "timestamp" : 1567620000, - "status" : "No data" + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" }, { - "numberOfDataPoints" : 24192, - "cardName" : "Card Name", - "endDate" : "2023-05-16T10:14:28Z", - "_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" + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" } }, - "cardId" : "lrxxr", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "previousValue" : 500, - "value" : 100, - "startDate" : "2023-05-16T10:14:28Z", - "timestamp" : 1567620000, - "status" : "No data" + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" } ], - "tests" : [ { - "graphlets" : [ { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] }, { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] } ], - "alertCount" : 398, - "testType" : "Web - HTTP Server", - "testId" : "68256", - "isShared" : true, - "testName" : "Http Test Name", - "target" : "www.google.com" + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" }, { - "graphlets" : [ { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] }, { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] } ], - "alertCount" : 398, - "testType" : "Web - HTTP Server", - "testId" : "68256", - "isShared" : true, - "testName" : "Http Test Name", - "target" : "www.google.com" + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" } ], - "columns" : [ { - "_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" + "columns" : [ { + "_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" } }, - "columnId" : "938to", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "status" : "No data" + "status" : "No data" }, { - "_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" + "_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" } }, - "columnId" : "938to", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "status" : "No data" + "status" : "No data" } ], - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "activeAlerts" : 483, - "startRound" : 1384309800, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "agents" : [ { - "agentId" : "6522", - "agentName" : "0c3898000117", - "location" : { - "locationName" : "San Francisco, California, US", - "latitude" : 37.77493, - "longitude" : -122.41942 + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "ipInfo" : { - "ipv6" : "ipv6", - "privateIp" : "172.58.92.31", - "operativeSystemVersion" : "operativeSystemVersion", - "publicIp" : "172.58.92.31" + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" }, - "status" : "online" + "status" : "online" }, { - "agentId" : "6522", - "agentName" : "0c3898000117", - "location" : { - "locationName" : "San Francisco, California, US", - "latitude" : 37.77493, - "longitude" : -122.41942 + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "ipInfo" : { - "ipv6" : "ipv6", - "privateIp" : "172.58.92.31", - "operativeSystemVersion" : "operativeSystemVersion", - "publicIp" : "172.58.92.31" + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" }, - "status" : "online" + "status" : "online" } ], - "status" : "No data" + "status" : "No data" }, - "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" + "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" } }, - "binSize" : 3600, - "startDate" : "2022-07-17T22:00:54Z" + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1324,9 +1388,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1348,9 +1416,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1375,9 +1447,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1402,9 +1478,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1429,9 +1509,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1456,9 +1540,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboard_snapshot_widget_data( + snapshot_id=snapshot_id, + widget_id=widget_id, + aid=aid, + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1473,577 +1561,581 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "pages" : { - "key" : "" + "pages" : { + "key" : "" }, - "_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" + "_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" + "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" + "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" } }, - "dashboardSnapshots" : [ { - "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "_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" + "dashboardSnapshots" : [ { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" }, - "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" + "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" : "" + "apiLinks" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "snapshotExpirationDate" : "2023-05-16T10:14:28Z", - "isScheduled" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "accountId" : 1234, - "createdDate" : "2023-05-16 10:14:28", - "snapshotName" : "HTTP Server Dashboard Snapshot", - "timeSpan" : { - "duration" : 60, - "start" : "2023-05-16T10:14:28Z", - "startDate" : "2023-05-16 10:14:28" + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" }, - "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "aid" : "1234", - "snapshotCreatedDate" : "2023-05-16T10:14:28Z", - "isShared" : true, - "dashboard" : { - "isMigratedReport" : false, - "dashboardCreatedBy" : "1", - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "modifiedBy" : 1, - "dashboardModifiedBy" : "1", - "migratedReport" : false, - "isDefaultForAccount" : false, - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "accountId" : 1234, - "apiLink" : [ { - "key" : "" + "accountId" : 1234, + "apiLink" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : 1, - "globalOverride" : true, - "modifiedDate" : "2023-05-16 10:14:28", - "isGlobalOverride" : true, - "aid" : "1234", - "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" }, - "expirationDate" : "2023-05-16 10:14:28" + "expirationDate" : "2023-05-16 10:14:28" }, { - "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "_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" + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_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" }, - "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" + "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" : "" + "apiLinks" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "snapshotExpirationDate" : "2023-05-16T10:14:28Z", - "isScheduled" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "accountId" : 1234, - "createdDate" : "2023-05-16 10:14:28", - "snapshotName" : "HTTP Server Dashboard Snapshot", - "timeSpan" : { - "duration" : 60, - "start" : "2023-05-16T10:14:28Z", - "startDate" : "2023-05-16 10:14:28" + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" }, - "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", - "aid" : "1234", - "snapshotCreatedDate" : "2023-05-16T10:14:28Z", - "isShared" : true, - "dashboard" : { - "isMigratedReport" : false, - "dashboardCreatedBy" : "1", - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "modifiedBy" : 1, - "dashboardModifiedBy" : "1", - "migratedReport" : false, - "isDefaultForAccount" : false, - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "accountId" : 1234, - "apiLink" : [ { - "key" : "" + "accountId" : 1234, + "apiLink" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : 1, - "globalOverride" : true, - "modifiedDate" : "2023-05-16 10:14:28", - "isGlobalOverride" : true, - "aid" : "1234", - "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" }, - "expirationDate" : "2023-05-16 10:14:28" + "expirationDate" : "2023-05-16 10:14:28" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2077,9 +2169,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2101,9 +2197,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2128,9 +2228,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2155,9 +2259,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2182,9 +2290,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2209,9 +2321,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboard_snapshots( + aid=aid, + dashboard_id=dashboard_id, + cursor=cursor, + _headers=self.te_headers("get_dashboard_snapshots", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2233,9 +2349,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' aid = '1234' response = self.api.update_dashboard_snapshot_expiration_date_with_http_info( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date"), ) self.assertEqual(204, response.status_code) @@ -2278,9 +2398,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2310,9 +2434,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2345,9 +2473,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2380,9 +2512,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2415,9 +2551,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2450,9 +2590,13 @@ class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_dashboard_snapshot_expiration_date( + snapshot_id=snapshot_id, + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + aid=aid, + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py index 56e850a2..52cd5593 100644 --- a/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py @@ -173,144 +173,147 @@ class TestDashboardsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "isMigratedReport" : false, - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForAccount" : false, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : "1", - "modifiedDate" : "2023-05-16T10:14:28Z", - "modifiedBy" : "1", - "isGlobalOverride" : true, - "aid" : "1234" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" } """ expected_response = json.loads(response_body_json) response = self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -481,8 +484,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -641,8 +647,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -804,8 +813,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -967,8 +979,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1130,8 +1145,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1293,8 +1311,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_dashboard( + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("create_dashboard", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1307,8 +1328,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): dashboard_id = '646f4d2ce3c99b0536c3821e' aid = '1234' response = self.api.delete_dashboard_with_http_info( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard"), ) self.assertEqual(204, response.status_code) @@ -1342,8 +1366,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1364,8 +1391,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1389,8 +1419,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1414,8 +1447,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1439,8 +1475,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1464,8 +1503,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("delete_dashboard", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1479,155 +1521,158 @@ class TestDashboardsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "isMigratedReport" : false, - "dashboardCreatedBy" : "1", - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "modifiedBy" : 1, - "dashboardModifiedBy" : "1", - "migratedReport" : false, - "isDefaultForAccount" : false, - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "accountId" : 1234, - "apiLink" : [ { - "key" : "" + "accountId" : 1234, + "apiLink" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : 1, - "globalOverride" : true, - "modifiedDate" : "2023-05-16 10:14:28", - "isGlobalOverride" : true, - "aid" : "1234", - "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1660,8 +1705,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1682,8 +1730,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1707,8 +1758,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1732,8 +1786,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1757,8 +1814,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1782,8 +1842,11 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboard( + dashboard_id=dashboard_id, + aid=aid, + _headers=self.te_headers("get_dashboard", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1802,441 +1865,449 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() response_body_json = """ { - "groupLabels" : [ { - "groupProperty" : "AGENT", - "groupLabels" : [ { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" }, { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" } ] }, { - "groupProperty" : "AGENT", - "groupLabels" : [ { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" }, { - "groupId" : "2565", - "groupLabel" : "San Francisco, CA" + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" } ] } ], - "data" : { - "alerts" : [ { - "alertType" : "network-end-to-end-server", - "durationInSeconds" : 25, - "alertSource" : "Http Test", - "active" : true, - "testId" : "56512", - "startTime" : "2023-06-02T08:54:00Z", - "alertId" : "2004945", - "ruleId" : "281724", - "alertRule" : "Http Test Rule" + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" }, { - "alertType" : "network-end-to-end-server", - "durationInSeconds" : 25, - "alertSource" : "Http Test", - "active" : true, - "testId" : "56512", - "startTime" : "2023-06-02T08:54:00Z", - "alertId" : "2004945", - "ruleId" : "281724", - "alertRule" : "Http Test Rule" + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" } ], - "summary" : { - "offline" : 2, - "online" : 10, - "disabled" : 3 + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 }, - "totalAlerts" : 500, - "cards" : [ { - "numberOfDataPoints" : 24192, - "cardName" : "Card Name", - "endDate" : "2023-05-16T10:14:28Z", - "_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" + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" } }, - "cardId" : "lrxxr", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "previousValue" : 500, - "value" : 100, - "startDate" : "2023-05-16T10:14:28Z", - "timestamp" : 1567620000, - "status" : "No data" + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" }, { - "numberOfDataPoints" : 24192, - "cardName" : "Card Name", - "endDate" : "2023-05-16T10:14:28Z", - "_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" + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" } }, - "cardId" : "lrxxr", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "previousValue" : 500, - "value" : 100, - "startDate" : "2023-05-16T10:14:28Z", - "timestamp" : 1567620000, - "status" : "No data" + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" } ], - "tests" : [ { - "graphlets" : [ { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] }, { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] } ], - "alertCount" : 398, - "testType" : "Web - HTTP Server", - "testId" : "68256", - "isShared" : true, - "testName" : "Http Test Name", - "target" : "www.google.com" + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" }, { - "graphlets" : [ { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] }, { - "metric" : "Availability", - "testId" : "68257", - "points" : [ { - "x" : 1580403900, - "y" : 128.249 + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 }, { - "x" : 1580403900, - "y" : 128.249 + "x" : 1580403900, + "y" : 128.249 } ] } ], - "alertCount" : 398, - "testType" : "Web - HTTP Server", - "testId" : "68256", - "isShared" : true, - "testName" : "Http Test Name", - "target" : "www.google.com" + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" } ], - "columns" : [ { - "_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" + "columns" : [ { + "_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" } }, - "columnId" : "938to", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "status" : "No data" + "status" : "No data" }, { - "_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" + "_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" } }, - "columnId" : "938to", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "status" : "No data" + "status" : "No data" } ], - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "activeAlerts" : 483, - "startRound" : 1384309800, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "agents" : [ { - "agentId" : "6522", - "agentName" : "0c3898000117", - "location" : { - "locationName" : "San Francisco, California, US", - "latitude" : 37.77493, - "longitude" : -122.41942 + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "ipInfo" : { - "ipv6" : "ipv6", - "privateIp" : "172.58.92.31", - "operativeSystemVersion" : "operativeSystemVersion", - "publicIp" : "172.58.92.31" + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" }, - "status" : "online" + "status" : "online" }, { - "agentId" : "6522", - "agentName" : "0c3898000117", - "location" : { - "locationName" : "San Francisco, California, US", - "latitude" : 37.77493, - "longitude" : -122.41942 + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 }, - "ipInfo" : { - "ipv6" : "ipv6", - "privateIp" : "172.58.92.31", - "operativeSystemVersion" : "operativeSystemVersion", - "publicIp" : "172.58.92.31" + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" }, - "status" : "online" + "status" : "online" } ], - "status" : "No data" + "status" : "No data" }, - "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" + "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" + "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" + "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" } }, - "binSize" : 3600, - "startDate" : "2022-07-17T22:00:54Z" + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2253,7 +2324,6 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() error_body_json = """ { "instance" : "instance", @@ -2277,16 +2347,25 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2303,7 +2382,6 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() error_body_json = """ { "error_description" : "Invalid access token", @@ -2315,16 +2393,25 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2341,7 +2428,6 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() error_body_json = """ { "instance" : "instance", @@ -2356,16 +2442,25 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2382,7 +2477,6 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() error_body_json = """ { "instance" : "instance", @@ -2397,16 +2491,25 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2423,7 +2526,6 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() error_body_json = """ { "instance" : "instance", @@ -2438,16 +2540,25 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2464,7 +2575,6 @@ class TestDashboardsApiIntegration(IntegrationTestBase): max = 10 cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' sort = 'alertStatus' - order = thousandeyes_sdk.dashboards.DashboardOrder() error_body_json = """ { "instance" : "instance", @@ -2479,16 +2589,25 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboard_widget_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + sort=sort, - order=order, + _headers=self.te_headers("get_dashboard_widget_data", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2501,298 +2620,300 @@ class TestDashboardsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ [ { - "isMigratedReport" : false, - "dashboardCreatedBy" : "1", - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "modifiedBy" : 1, - "dashboardModifiedBy" : "1", - "migratedReport" : false, - "isDefaultForAccount" : false, - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "accountId" : 1234, - "apiLink" : [ { - "key" : "" + "accountId" : 1234, + "apiLink" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : 1, - "globalOverride" : true, - "modifiedDate" : "2023-05-16 10:14:28", - "isGlobalOverride" : true, - "aid" : "1234", - "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" }, { - "isMigratedReport" : false, - "dashboardCreatedBy" : "1", - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "modifiedBy" : 1, - "dashboardModifiedBy" : "1", - "migratedReport" : false, - "isDefaultForAccount" : false, - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "accountId" : 1234, - "apiLink" : [ { - "key" : "" + "accountId" : 1234, + "apiLink" : [ { + "key" : "" }, { - "key" : "" + "key" : "" } ], - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : 1, - "globalOverride" : true, - "modifiedDate" : "2023-05-16 10:14:28", - "isGlobalOverride" : true, - "aid" : "1234", - "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" } ] """ expected_response = json.loads(response_body_json) response = self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2824,7 +2945,9 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2844,7 +2967,9 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2867,7 +2992,9 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2890,7 +3017,9 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2913,7 +3042,9 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2936,7 +3067,9 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboards( + aid=aid, + _headers=self.te_headers("get_dashboards", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2955,58 +3088,66 @@ class TestDashboardsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' response_body_json = """ { - "numberOfDataPoints" : 24192, - "cardName" : "Card Name", - "endDate" : "2023-05-16T10:14:28Z", - "_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" + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_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" } }, - "cardId" : "lrxxr", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "previousValue" : 500, - "value" : 100, - "startDate" : "2023-05-16T10:14:28Z", - "timestamp" : 1567620000, - "status" : "No data" + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" } """ expected_response = json.loads(response_body_json) response = self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -3044,13 +3185,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3076,13 +3225,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3111,13 +3268,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3146,13 +3311,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3181,13 +3354,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3216,13 +3397,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_individual_card_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + card_id=card_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_card_data", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3241,74 +3430,82 @@ class TestDashboardsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' 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" + "_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" } }, - "columnId" : "938to", - "alertSuppressionWindows" : [ { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] }, { - "testIds" : [ "281474976710661" ], - "repeatUnit" : "week", - "durationInSeconds" : 7200, - "repeat" : "custom", - "name" : "Test dashboards", - "repeatEvery" : 5, - "id" : "281474976710662", - "startTimes" : [ "2023-05-16T10:14:28Z" ] + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "binSize" : 3600, - "points" : [ { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 }, { - "numberOfDataPoints" : 23304, - "groups" : [ { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" }, { - "groupProperty" : "COUNTRY", - "groupValue" : "US" + "groupProperty" : "COUNTRY", + "groupValue" : "US" } ], - "value" : 100, - "timestamp" : 1567620000 + "value" : 100, + "timestamp" : 1567620000 } ], - "status" : "No data" + "status" : "No data" } """ expected_response = json.loads(response_body_json) response = self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -3346,13 +3543,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3378,13 +3583,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3413,13 +3626,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3448,13 +3669,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3483,13 +3712,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3518,13 +3755,21 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_individual_column_data( + dashboard_id=dashboard_id, + widget_id=widget_id, + column_id=column_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + _headers=self.te_headers("get_individual_column_data", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3677,145 +3922,149 @@ class TestDashboardsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "isMigratedReport" : false, - "_links" : { - "snapshots" : { - "hreflang" : "hreflang", - "templated" : true, - "profile" : "profile", - "name" : "name", - "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", - "type" : "type", - "deprecation" : "deprecation", - "title" : "title" + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "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" + "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" } }, - "isDefaultForAccount" : false, - "isDefaultForUser" : true, - "description" : "HTTP Server Widgets", - "isPrivate" : true, - "title" : "HTTP Server Widgets", - "isBuiltIn" : true, - "widgets" : [ { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" }, { - "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", - "shouldExcludeAlertSuppressionWindows" : 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" + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : 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" } }, - "visualMode" : "Full", - "filters" : { - "TEST" : [ 5187, 5227 ], - "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] }, - "title" : "Widget Title", - "type" : "Agent Status", - "metricGroup" : "BGP", - "measure" : { - "percentileValue" : 95, - "type" : "MEAN" + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" }, - "apiLink" : "apiLink", - "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", - "isEmbedded" : true, - "id" : "1234", - "fixedTimespan" : { - "unit" : "Days", - "value" : 10 + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 }, - "dataSource" : "ENDPOINT_AGENTS", - "direction" : "FROM_TARGET" + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" } ], - "defaultTimespan" : { - "duration" : 7200, - "timespanDuration" : 7200, - "start" : "2023-05-16T10:14:28Z", - "end" : "2023-05-16T11:14:28Z", - "timespanStart" : "2023-05-16 10:14:28", - "timespanEnd" : "2023-05-16 11:14:28" + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" }, - "layout" : { - "layoutId" : "grid-layout-1", - "type" : "grid", - "details" : { - "widgetPositioning" : [ { - "x" : 0, - "y" : 0, - "w" : 9, - "h" : 5, - "id" : "widgetId-71lbb" + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" } ] } }, - "globalFilterId" : "65babd9bb90bf55b17c96c8d", - "dashboardId" : "5e1f7a99143ae6004fdc3bb4", - "createdBy" : "1", - "modifiedDate" : "2023-05-16T10:14:28Z", - "modifiedBy" : "1", - "isGlobalOverride" : true, - "aid" : "1234" + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" } """ expected_response = json.loads(response_body_json) response = self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -3987,9 +4236,13 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4149,9 +4402,13 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4314,9 +4571,13 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4479,9 +4740,13 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4644,9 +4909,13 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4809,9 +5078,13 @@ class TestDashboardsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_dashboard( + dashboard_id=dashboard_id, + dashboard=dashboard, + aid=aid, + _headers=self.te_headers("update_dashboard", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py index e50a0a17..eb0562ad 100644 --- a/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py @@ -66,61 +66,64 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "createdDate" : "2024-02-01T22:19:19Z", - "createdBy" : { - "uid" : "1", - "name" : "Test User" + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" }, - "_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" + "_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" } }, - "context" : [ { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] }, { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] } ], - "name" : "cea-filter", - "modifiedDate" : "2024-02-01T22:19:19Z", - "description" : "Global filter for CEA widgets", - "modifiedBy" : { - "uid" : "1", - "name" : "Test User" + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" }, - "id" : "65bc18e8f2073a4a469cd958", - "aid" : "11" + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" } """ expected_response = json.loads(response_body_json) response = self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -184,8 +187,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -237,8 +243,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -293,8 +302,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -349,8 +361,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -405,8 +420,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -461,8 +479,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_dashboard_filter( + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("create_dashboard_filter", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -475,8 +496,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): id = '65bc18e8f2073a4a469cd958' aid = '1234' response = self.api.delete_dashboard_filter_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter"), ) self.assertEqual(204, response.status_code) @@ -510,8 +534,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -532,8 +559,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -557,8 +587,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -582,8 +615,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -607,8 +643,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -632,8 +671,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("delete_dashboard_filter", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -647,61 +689,64 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "createdDate" : "2024-02-01T22:19:19Z", - "createdBy" : { - "uid" : "1", - "name" : "Test User" + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" }, - "_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" + "_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" } }, - "context" : [ { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] }, { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] } ], - "name" : "cea-filter", - "modifiedDate" : "2024-02-01T22:19:19Z", - "description" : "Global filter for CEA widgets", - "modifiedBy" : { - "uid" : "1", - "name" : "Test User" + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" }, - "id" : "65bc18e8f2073a4a469cd958", - "aid" : "11" + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -734,8 +779,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -756,8 +804,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -781,8 +832,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -806,8 +860,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -831,8 +888,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -856,8 +916,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboard_filter( + id=id, + aid=aid, + _headers=self.te_headers("get_dashboard_filter", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -871,113 +934,116 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "dashboardFilters" : [ { - "createdDate" : "2024-02-01T22:19:19Z", - "createdBy" : { - "uid" : "1", - "name" : "Test User" + "dashboardFilters" : [ { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" }, - "_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" + "_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" } }, - "context" : [ { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] }, { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] } ], - "name" : "cea-filter", - "modifiedDate" : "2024-02-01T22:19:19Z", - "description" : "Global filter for CEA widgets", - "modifiedBy" : { - "uid" : "1", - "name" : "Test User" + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" }, - "id" : "65bc18e8f2073a4a469cd958", - "aid" : "11" + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" }, { - "createdDate" : "2024-02-01T22:19:19Z", - "createdBy" : { - "uid" : "1", - "name" : "Test User" + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" }, - "_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" + "_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" } }, - "context" : [ { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] }, { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] } ], - "name" : "cea-filter", - "modifiedDate" : "2024-02-01T22:19:19Z", - "description" : "Global filter for CEA widgets", - "modifiedBy" : { - "uid" : "1", - "name" : "Test User" + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" }, - "id" : "65bc18e8f2073a4a469cd958", - "aid" : "11" + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1010,8 +1076,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1032,8 +1101,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1057,8 +1129,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1082,8 +1157,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1107,8 +1185,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1132,8 +1213,11 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dashboards_filters( + search_pattern=search_pattern, + aid=aid, + _headers=self.te_headers("get_dashboards_filters", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1179,62 +1263,66 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "createdDate" : "2024-02-01T22:19:19Z", - "createdBy" : { - "uid" : "1", - "name" : "Test User" + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" }, - "_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" + "_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" } }, - "context" : [ { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] }, { - "dataSourceId" : "VIRTUAL_AGENT", - "filters" : [ { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] }, { - "filterId" : "TEST_LABEL", - "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], - "values" : [ "45862", "59749" ] + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] } ] } ], - "name" : "cea-filter", - "modifiedDate" : "2024-02-01T22:19:19Z", - "description" : "Global filter for CEA widgets", - "modifiedBy" : { - "uid" : "1", - "name" : "Test User" + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" }, - "id" : "65bc18e8f2073a4a469cd958", - "aid" : "11" + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" } """ expected_response = json.loads(response_body_json) response = self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1299,9 +1387,13 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1354,9 +1446,13 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1412,9 +1508,13 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1470,9 +1570,13 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1528,9 +1632,13 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1586,9 +1694,13 @@ class TestDashboardsFiltersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_dashboard_filter( + id=id, + api_context_filter_request=api_context_filter_request, + aid=aid, + _headers=self.te_headers("update_dashboard_filter", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py b/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py index 7aca00ab..4dee7203 100644 --- a/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py +++ b/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py @@ -44,20 +44,23 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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 + "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) @@ -87,8 +90,11 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -121,8 +127,11 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -155,8 +164,11 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -189,8 +201,11 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -223,8 +238,11 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -234,45 +252,44 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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 + "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 + "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" + "_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) @@ -280,7 +297,6 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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", @@ -292,7 +308,7 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -300,7 +316,6 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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", @@ -315,7 +330,7 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -323,7 +338,6 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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", @@ -338,7 +352,7 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -346,7 +360,6 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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", @@ -361,7 +374,7 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -369,7 +382,6 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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", @@ -384,7 +396,7 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -397,32 +409,34 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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" + "_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" + "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" + "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) @@ -442,7 +456,9 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -465,7 +481,9 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -488,7 +506,9 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -511,7 +531,9 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) @@ -534,7 +556,9 @@ class TestEmulationApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py index e32711ce..d48de450 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py @@ -40,102 +40,110 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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" + "_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" + "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" + "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" + "logItemType" : "wifi-connect", + "channel" : "36", + "physicalMode" : "802.11ac", + "physicalModeFrom" : "802.11n", + "ssid" : "CorpWiFi", + "channelFrom" : "11" }, - "agentLogItemType" : "wifi", - "onlineOfflineLogItem" : { - "logItemType" : "online" + "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" + "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" + "stateChangesLogItem" : { + "logItemType" : "enabled" }, - "timestampMs" : 1709240000000 + "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" + "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" + "logItemType" : "wifi-connect", + "channel" : "36", + "physicalMode" : "802.11ac", + "physicalModeFrom" : "802.11n", + "ssid" : "CorpWiFi", + "channelFrom" : "11" }, - "agentLogItemType" : "wifi", - "onlineOfflineLogItem" : { - "logItemType" : "online" + "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" + "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" + "stateChangesLogItem" : { + "logItemType" : "enabled" }, - "timestampMs" : 1709240000000 + "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) @@ -173,13 +181,21 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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) @@ -205,13 +221,21 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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) @@ -240,13 +264,21 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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) @@ -275,13 +307,21 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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) @@ -310,13 +350,21 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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) @@ -345,13 +393,21 @@ class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py index b27db3da..6ab87427 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py @@ -33,11 +33,12 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for delete_endpoint_agent success path""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] response = self.api.delete_endpoint_agent_with_http_info( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("delete_endpoint_agent"), ) self.assertEqual(204, response.status_code) @@ -48,7 +49,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for delete_endpoint_agent error path (HTTP 401)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -60,9 +60,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -72,7 +74,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for delete_endpoint_agent error path (HTTP 403)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "instance" : "instance", @@ -87,9 +88,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -99,7 +102,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for delete_endpoint_agent error path (HTTP 404)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "instance" : "instance", @@ -114,9 +116,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -126,7 +130,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for delete_endpoint_agent error path (HTTP 429)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "instance" : "instance", @@ -141,9 +144,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + _headers=self.te_headers("delete_endpoint_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -157,190 +162,193 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] } """ expected_response = json.loads(response_body_json) response = self.api.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -361,8 +369,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -386,8 +397,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -411,8 +425,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -436,8 +453,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.disable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("disable_endpoint_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -451,190 +471,193 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] } """ expected_response = json.loads(response_body_json) response = self.api.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -655,8 +678,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -680,8 +706,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -705,8 +734,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -730,8 +762,11 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.enable_endpoint_agent( + agent_id=agent_id, + aid=aid, + _headers=self.te_headers("enable_endpoint_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -785,379 +820,378 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false 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" + "_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" } }, - "totalAgents" : 1, - "agents" : [ { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] }, { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] } ] @@ -1165,12 +1199,17 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """ expected_response = json.loads(response_body_json) response = self.api.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1222,7 +1261,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1247,12 +1285,17 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1304,7 +1347,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1317,12 +1359,17 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1374,7 +1421,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1390,12 +1436,17 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1447,7 +1498,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1463,12 +1513,17 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_endpoint_agents( + agent_search_request=agent_search_request, + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("filter_endpoint_agents", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1480,196 +1535,198 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent success path""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false response_body_json = """ { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1679,7 +1736,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 401)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1692,10 +1748,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1705,7 +1764,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 403)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1721,10 +1779,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1734,7 +1795,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 404)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1750,10 +1810,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1763,7 +1826,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 429)""" agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false error_body_json = """ { @@ -1779,10 +1841,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + include_deleted=include_deleted, + _headers=self.te_headers("get_endpoint_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1795,392 +1860,391 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false use_all_permitted_aids = False agent_name = 'agent_name_example' computer_name = 'computer_name_example' 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" + "_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" + "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" } }, - "totalAgents" : 1, - "agents" : [ { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] }, { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] } ] @@ -2188,14 +2252,21 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """ expected_response = json.loads(response_body_json) response = self.api.get_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2206,7 +2277,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false use_all_permitted_aids = False agent_name = 'agent_name_example' @@ -2222,14 +2292,21 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2240,7 +2317,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false use_all_permitted_aids = False agent_name = 'agent_name_example' @@ -2259,14 +2335,21 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2277,7 +2360,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] include_deleted = false use_all_permitted_aids = False agent_name = 'agent_name_example' @@ -2296,14 +2378,21 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_endpoint_agents( + max=max, + cursor=cursor, + aid=aid, - expand=expand, + include_deleted=include_deleted, + use_all_permitted_aids=use_all_permitted_aids, + agent_name=agent_name, + computer_name=computer_name, + _headers=self.te_headers("get_endpoint_agents", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2316,24 +2405,26 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "connectionString" : "D2xZSLlqo64Xe2EnYisklA==", - "_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" + "connectionString" : "D2xZSLlqo64Xe2EnYisklA==", + "_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_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2353,7 +2444,9 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_endpoint_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2376,7 +2469,9 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_endpoint_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2399,7 +2494,9 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_endpoint_agents_connection_string( + aid=aid, + _headers=self.te_headers("get_endpoint_agents_connection_string", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2420,195 +2517,197 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] response_body_json = """ { - "npcapVersion" : "npcapVersion", - "asnDetails" : { - "asName" : "Virgin Media Limited", - "asNumber" : 5089 + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 }, - "clients" : [ { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } }, { - "browserExtensions" : [ { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true }, { - "browser" : "edge", - "profile" : "Profile 1", - "active" : true, - "error" : "", - "version" : "0.123.0", - "enabled" : true + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true } ], - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" } } ], - "agentType" : "endpoint", - "_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" + "agentType" : "endpoint", + "_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" } }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "publicIP" : "88.45.2.123", - "tcpDriverAvailable" : true, - "platform" : "mac", - "manufacturer" : "Apple, Inc.", - "targetVersion" : "0.123.4", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", - "createdAt" : "2022-05-26T23:37:16Z", - "numberOfClients" : 3, - "licenseType" : "essentials", - "osVersion" : "Version 10.15.2 (Build 19C57)", - "computerName" : "DESKJET-123", - "freeDiskSpaceNormalized" : 0.41, - "model" : "MacBookAir7,2", - "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "nicDriverVersion" : "22.250.0.9", - "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", - "externalMetadata" : [ { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" }, { - "key" : "anyConnectDeviceId", - "value" : "DF434343D" + "key" : "anyConnectDeviceId", + "value" : "DF434343D" } ], - "version" : "0.123.4", - "vpnProfiles" : [ { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] }, { - "vpnClientNetworkRange" : [ "10.100.0.0/22" ], - "vpnGatewayAddress" : "vpnGatewayAddress", - "vpnType" : "cisco-anyconnect", - "interfaceName" : "interfaceName", - "vpnClientAddresses" : [ "10.100.0.10" ] + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] } ], - "lastSeen" : "2022-05-26T23:37:16Z", - "deleted" : true, - "totalMemory" : "16384 MB", - "kernelVersion" : "Darwin 19.2.0", - "name" : "Office Printer", - "location" : { - "locationName" : "London", - "latitude" : 51.51279, - "longitude" : -0.09184 + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 }, - "aid" : "", - "status" : "enabled", - "networkInterfaceProfiles" : [ { - "ethernetProfile" : { - "linkSpeed" : 0 + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } }, { - "ethernetProfile" : { - "linkSpeed" : 0 + "ethernetProfile" : { + "linkSpeed" : 0 }, - "hardwareType" : "wireless", - "interfaceName" : "en0", - "addressProfiles" : [ { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" }, { - "prefixLength" : 24, - "addressType" : "unique-local", - "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", - "routerHardwareAddress" : "5c:b1:3e:46:1c:84", - "gateway" : "192.168.0.254" + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" } ], - "wirelessProfile" : { - "rssi" : -36, - "bssid" : "00:11:22:aa:bb:cc", - "channel" : 48, - "phyMode" : "802.11ac", - "ssid" : "GuestWiFi" + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" } } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2627,7 +2726,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2639,10 +2737,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2661,7 +2762,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "instance" : "instance", @@ -2676,10 +2776,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2698,7 +2801,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "instance" : "instance", @@ -2713,10 +2815,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2735,7 +2840,6 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json) agent_id = 'agent_id_example' aid = '1234' - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] error_body_json = """ { "instance" : "instance", @@ -2750,10 +2854,13 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_endpoint_agent( + agent_id=agent_id, + aid=aid, - expand=expand, + endpoint_agent_update=endpoint_agent_update, + _headers=self.te_headers("update_endpoint_agent", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py index 52a14b13..7203b700 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py @@ -50,37 +50,40 @@ class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "items" : [ { - "status" : 200, - "detail" : "Initiated", - "request" : { - "agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba", - "fromAid" : "1234", - "toAid" : "12345" + "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" : 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" + "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) @@ -128,8 +131,11 @@ class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase): 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) @@ -165,8 +171,11 @@ class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase): 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) @@ -205,8 +214,11 @@ class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase): 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) @@ -245,8 +257,11 @@ class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase): 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) @@ -285,8 +300,11 @@ class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py index 9c5b77a8..b1afd0b0 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py @@ -34,36 +34,38 @@ class TestEndpointProxiesApiIntegration(IntegrationTestBase): 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" + "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" + "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) @@ -83,7 +85,9 @@ class TestEndpointProxiesApiIntegration(IntegrationTestBase): 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) @@ -106,7 +110,9 @@ class TestEndpointProxiesApiIntegration(IntegrationTestBase): 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) @@ -129,7 +135,9 @@ class TestEndpointProxiesApiIntegration(IntegrationTestBase): 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) @@ -152,7 +160,9 @@ class TestEndpointProxiesApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py index 49a5b581..9f16a4ce 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py @@ -51,59 +51,62 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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" + "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" + "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" + "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 + "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 + "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 + "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" + "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) @@ -152,8 +155,11 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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) @@ -190,8 +196,11 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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) @@ -231,8 +240,11 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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) @@ -272,8 +284,11 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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) @@ -313,8 +328,11 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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) @@ -354,8 +372,11 @@ class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTe 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) diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py index 52acabf7..5a328fba 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py @@ -62,70 +62,73 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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" + "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" + "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" + "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 + "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 + "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 + "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" + "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) @@ -185,8 +188,11 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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) @@ -234,8 +240,11 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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) @@ -286,8 +295,11 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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) @@ -338,8 +350,11 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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) @@ -390,8 +405,11 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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) @@ -442,8 +460,11 @@ class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestB 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) diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py index a227b665..afb8fb88 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py @@ -35,13 +35,16 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "message" : "Successfully reran the instant scheduled test with testId=765231567" + "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) @@ -74,8 +77,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -96,8 +102,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -121,8 +130,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -146,8 +158,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -171,8 +186,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -196,8 +214,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -221,8 +242,11 @@ class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py b/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py index f2366c97..ed40b1b1 100644 --- a/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py +++ b/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py @@ -54,37 +54,40 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "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" + "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" + "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" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -136,8 +139,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -177,8 +183,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -221,8 +230,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -265,8 +277,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_endpoint_label( + aid=aid, + label_request=label_request, + _headers=self.te_headers("create_endpoint_label", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -279,8 +294,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): id = 'id_example' aid = '1234' response = self.api.delete_endpoint_label_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label"), ) self.assertEqual(204, response.status_code) @@ -302,8 +320,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -327,8 +348,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -352,8 +376,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -377,8 +404,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_endpoint_label( + id=id, + aid=aid, + _headers=self.te_headers("delete_endpoint_label", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -389,42 +419,43 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): def test_get_endpoint_label_happy_path(self) -> None: """Integration test for get_endpoint_label success path""" id = 'id_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' response_body_json = """ { - "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" + "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" + "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" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_endpoint_label( + id=id, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -433,7 +464,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): def test_get_endpoint_label_error_401(self) -> None: """Integration test for get_endpoint_label error path (HTTP 401)""" id = 'id_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -446,9 +476,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_endpoint_label( + id=id, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -457,7 +489,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): def test_get_endpoint_label_error_403(self) -> None: """Integration test for get_endpoint_label error path (HTTP 403)""" id = 'id_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -473,9 +504,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_endpoint_label( + id=id, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -484,7 +517,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): def test_get_endpoint_label_error_404(self) -> None: """Integration test for get_endpoint_label error path (HTTP 404)""" id = 'id_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -500,9 +532,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_endpoint_label( + id=id, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -511,7 +545,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): def test_get_endpoint_label_error_429(self) -> None: """Integration test for get_endpoint_label error path (HTTP 429)""" id = 'id_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -527,9 +560,11 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_endpoint_label( + id=id, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_label", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -541,93 +576,95 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_labels success path""" max = 5 cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' 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" + "_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" + "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" + "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" + "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" + "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" + "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" + "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" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" } ] } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_endpoint_labels( + max=max, + cursor=cursor, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -637,7 +674,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_labels error path (HTTP 401)""" max = 5 cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -650,10 +686,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_endpoint_labels( + max=max, + cursor=cursor, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -663,7 +702,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_labels error path (HTTP 403)""" max = 5 cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -679,10 +717,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_endpoint_labels( + max=max, + cursor=cursor, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -692,7 +733,6 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_labels error path (HTTP 429)""" max = 5 cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] aid = '1234' error_body_json = """ { @@ -708,10 +748,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_endpoint_labels( + max=max, + cursor=cursor, - expand=expand, + aid=aid, + _headers=self.te_headers("get_endpoint_labels", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -745,38 +788,42 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "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" + "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" + "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" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -829,9 +876,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -872,9 +923,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -918,9 +973,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -964,9 +1023,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1010,9 +1073,13 @@ class TestEndpointAgentLabelsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_endpoint_label( + id=id, + aid=aid, + label=label, + _headers=self.te_headers("update_endpoint_label", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py index 40df274b..2b2f5860 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py @@ -37,364 +37,369 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] response_body_json = """ { - "test" : { - "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" + "test" : { + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" }, - "totalHits" : 12, - "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" + "totalHits" : 12, + "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" + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "numRedirects" : 0, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "errorType" : "connect", - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "responseCode" : 200, - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "connectTime" : 2, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "throughput" : 190, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "redirectTime" : 10, - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "testId" : "584739201", - "sslTime" : 9, - "aid" : "1234", - "waitTime" : 3, - "errorDetails" : "errorDetails", - "wireSize" : 9993 + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "numRedirects" : 0, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "errorType" : "connect", - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "responseCode" : 200, - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "connectTime" : 2, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "throughput" : 190, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "redirectTime" : 10, - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "testId" : "584739201", - "sslTime" : 9, - "aid" : "1234", - "waitTime" : 3, - "errorDetails" : "errorDetails", - "wireSize" : 9993 + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -408,7 +413,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -420,13 +424,19 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(401) ) as context: self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -440,7 +450,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -455,13 +464,19 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(403) ) as context: self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -475,7 +490,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -490,13 +504,19 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(404) ) as context: self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -510,7 +530,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -525,13 +544,19 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(429) ) as context: self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -545,7 +570,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -560,13 +584,19 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(500) ) as context: self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -580,7 +610,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -595,13 +624,19 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(502) ) as context: self.api.get_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_http_server_scheduled_test_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -648,305 +683,311 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] response_body_json = """ { - "totalHits" : 12, - "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" + "totalHits" : 12, + "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" + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "numRedirects" : 0, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "errorType" : "connect", - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "responseCode" : 200, - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "connectTime" : 2, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "throughput" : 190, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "redirectTime" : 10, - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "testId" : "584739201", - "sslTime" : 9, - "aid" : "1234", - "waitTime" : 3, - "errorDetails" : "errorDetails", - "wireSize" : 9993 + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "numRedirects" : 0, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "errorType" : "connect", - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "responseCode" : 200, - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "connectTime" : 2, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "throughput" : 190, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "redirectTime" : 10, - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "testId" : "584739201", - "sslTime" : 9, - "aid" : "1234", - "waitTime" : 3, - "errorDetails" : "errorDetails", - "wireSize" : 9993 + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -991,7 +1032,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1015,14 +1055,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(400) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1067,7 +1114,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1079,14 +1125,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(401) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1131,7 +1184,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1146,14 +1198,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(403) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1198,7 +1257,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1213,14 +1271,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(404) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1265,7 +1330,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1280,14 +1344,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(429) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1332,7 +1403,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1347,14 +1417,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(500) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1399,7 +1476,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1414,14 +1490,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(502) ) as context: self.api.get_multi_test_filtered_http_server_scheduled_test_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_multi_test_filtered_http_server_scheduled_test_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1468,305 +1551,311 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] response_body_json = """ { - "totalHits" : 12, - "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" + "totalHits" : 12, + "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" + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "numRedirects" : 0, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "errorType" : "connect", - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "responseCode" : 200, - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "connectTime" : 2, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "throughput" : 190, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "redirectTime" : 10, - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "testId" : "584739201", - "sslTime" : 9, - "aid" : "1234", - "waitTime" : 3, - "errorDetails" : "errorDetails", - "wireSize" : 9993 + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "numRedirects" : 0, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "errorType" : "connect", - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "responseCode" : 200, - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "connectTime" : 2, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "throughput" : 190, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "redirectTime" : 10, - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "testId" : "584739201", - "sslTime" : 9, - "aid" : "1234", - "waitTime" : 3, - "errorDetails" : "errorDetails", - "wireSize" : 9993 + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1811,7 +1900,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1835,14 +1923,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(400) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1887,7 +1982,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1899,14 +1993,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(401) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1951,7 +2052,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -1966,14 +2066,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(403) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2018,7 +2125,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -2033,14 +2139,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(404) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2085,7 +2198,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -2100,14 +2212,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(429) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2152,7 +2271,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -2167,14 +2285,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(500) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2219,7 +2344,6 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] error_body_json = """ { "instance" : "instance", @@ -2234,14 +2358,21 @@ class TestHTTPServerEndpointScheduledTestResultsApiIntegration(IntegrationTestBa ApiException.exception_class_for_http_status(502) ) as context: self.api.get_single_test_filtered_http_server_scheduled_test_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + http_endpoint_tests_data_rounds_search=http_endpoint_tests_data_rounds_search, + _headers=self.te_headers("get_single_test_filtered_http_server_scheduled_test_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py index 44db53f5..43ddded4 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py @@ -68,363 +68,368 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] 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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "dnsServerTest" : { - "resolutionTime" : 3 + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 }, - "isIcmpBlocked" : true, - "gatewayScore" : { - "score" : 100, - "quality" : "great" + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" }, - "tcpConnect" : { - "rtt" : 77.777, - "errorCode" : "ERR_TIMED_OUT", - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "vpnScore" : { - "score" : 100, - "quality" : "great" + "vpnScore" : { + "score" : 100, + "quality" : "great" }, - "proxyScore" : { - "score" : 100, - "quality" : "great" + "proxyScore" : { + "score" : 100, + "quality" : "great" }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "type" : "vpn", - "targetPort" : 80, - "platform" : "mac", - "target" : "10.0.2.2", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "systemMetricDetails" : { - "topCpuApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ], - "topMemoryApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ] }, - "connectionScore" : { - "score" : 100, - "quality" : "great" + "connectionScore" : { + "score" : 100, + "quality" : "great" }, - "icmpPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", - "roundId" : 1384309800, - "agentScore" : { - "score" : 100, - "quality" : "great" + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" } }, { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "dnsServerTest" : { - "resolutionTime" : 3 + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 }, - "isIcmpBlocked" : true, - "gatewayScore" : { - "score" : 100, - "quality" : "great" + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" }, - "tcpConnect" : { - "rtt" : 77.777, - "errorCode" : "ERR_TIMED_OUT", - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "vpnScore" : { - "score" : 100, - "quality" : "great" + "vpnScore" : { + "score" : 100, + "quality" : "great" }, - "proxyScore" : { - "score" : 100, - "quality" : "great" + "proxyScore" : { + "score" : 100, + "quality" : "great" }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "type" : "vpn", - "targetPort" : 80, - "platform" : "mac", - "target" : "10.0.2.2", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "systemMetricDetails" : { - "topCpuApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ], - "topMemoryApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ] }, - "connectionScore" : { - "score" : 100, - "quality" : "great" + "connectionScore" : { + "score" : 100, + "quality" : "great" }, - "icmpPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", - "roundId" : 1384309800, - "agentScore" : { - "score" : 100, - "quality" : "great" + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" } } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -469,7 +474,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -493,13 +497,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -544,7 +554,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -556,13 +565,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -607,7 +622,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -622,13 +636,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -673,7 +693,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -688,13 +707,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -739,7 +764,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -754,13 +778,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -805,7 +835,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -820,13 +849,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -871,7 +906,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -886,13 +920,19 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_local_networks_test_results_topologies( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_network_topology_result_request=endpoint_network_topology_result_request, + _headers=self.te_headers("filter_local_networks_test_results_topologies", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -905,34 +945,36 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "localNetworks" : [ { - "publicIpRange" : "178.216.56.0-178.216.63.255", - "networkName" : "10.5.51.0 (in 178.216.56.0/21)", - "networkId" : "006c4fa7a054", - "localPrefix" : "10.5.51.0" + "localNetworks" : [ { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" }, { - "publicIpRange" : "178.216.56.0-178.216.63.255", - "networkName" : "10.5.51.0 (in 178.216.56.0/21)", - "networkId" : "006c4fa7a054", - "localPrefix" : "10.5.51.0" + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" } ], - "_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" + "_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_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -952,7 +994,9 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -975,7 +1019,9 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -998,7 +1044,9 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1021,7 +1069,9 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1044,7 +1094,9 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1067,7 +1119,9 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_local_networks_test_results( + aid=aid, + _headers=self.te_headers("get_local_networks_test_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1079,597 +1133,598 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology success path""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] 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" + "_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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "dnsServerTest" : { - "resolutionTime" : 3 + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 }, - "vpnScore" : { - "score" : 100, - "quality" : "great" + "vpnScore" : { + "score" : 100, + "quality" : "great" }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "type" : "vpn", - "targetPort" : 80, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "icmpTraceroute" : { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "roundId" : 1384309800, - "agentScore" : { - "score" : 100, - "quality" : "great" + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" }, - "isIcmpBlocked" : true, - "gatewayScore" : { - "score" : 100, - "quality" : "great" + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" }, - "tcpConnect" : { - "rtt" : 77.777, - "errorCode" : "ERR_TIMED_OUT", - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "proxyScore" : { - "score" : 100, - "quality" : "great" + "proxyScore" : { + "score" : 100, + "quality" : "great" }, - "coordinates" : { - "latitude" : 46.0552778, - "location" : "Slovenia", - "longitude" : 14.5144444 + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 }, - "icmpTraceroutes" : [ { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] } ], - "target" : "10.0.2.2", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "systemMetricDetails" : { - "topCpuApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ], - "topMemoryApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ] }, - "connectionScore" : { - "score" : 100, - "quality" : "great" + "connectionScore" : { + "score" : 100, + "quality" : "great" }, - "icmpPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" }, { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "dnsServerTest" : { - "resolutionTime" : 3 + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 }, - "vpnScore" : { - "score" : 100, - "quality" : "great" + "vpnScore" : { + "score" : 100, + "quality" : "great" }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "type" : "vpn", - "targetPort" : 80, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "icmpTraceroute" : { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "roundId" : 1384309800, - "agentScore" : { - "score" : 100, - "quality" : "great" + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" }, - "isIcmpBlocked" : true, - "gatewayScore" : { - "score" : 100, - "quality" : "great" + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" }, - "tcpConnect" : { - "rtt" : 77.777, - "errorCode" : "ERR_TIMED_OUT", - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "proxyScore" : { - "score" : 100, - "quality" : "great" + "proxyScore" : { + "score" : 100, + "quality" : "great" }, - "coordinates" : { - "latitude" : 46.0552778, - "location" : "Slovenia", - "longitude" : 14.5144444 + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 }, - "icmpTraceroutes" : [ { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] } ], - "target" : "10.0.2.2", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "systemMetricDetails" : { - "topCpuApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ], - "topMemoryApplications" : [ { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 }, { - "totalMemoryBytes" : 1023334, - "processes" : [ { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 }, { - "memoryBytes" : 1023334, - "memoryPercentage" : 0.22, - "name" : "Webex background", - "cpu" : 0.5, - "pid" : 15632 + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 } ], - "totalCpu" : 0.5, - "name" : "Webex", - "totalMemoryPercentage" : 0.22 + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 } ] }, - "connectionScore" : { - "score" : 100, - "quality" : "great" + "connectionScore" : { + "score" : 100, + "quality" : "great" }, - "icmpPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1679,7 +1734,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology error path (HTTP 401)""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1691,9 +1745,11 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1703,7 +1759,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology error path (HTTP 403)""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -1718,9 +1773,11 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1730,7 +1787,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology error path (HTTP 404)""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -1745,9 +1801,11 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1757,7 +1815,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology error path (HTTP 429)""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -1772,9 +1829,11 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1784,7 +1843,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology error path (HTTP 500)""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -1799,9 +1857,11 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1811,7 +1871,6 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): """Integration test for get_local_networks_test_results_topology error path (HTTP 502)""" network_topology_id = '00160:39c518560de9:1491651900:236e6f18' aid = '1234' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] error_body_json = """ { "instance" : "instance", @@ -1826,9 +1885,11 @@ class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_local_networks_test_results_topology( + network_topology_id=network_topology_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_local_networks_test_results_topology", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py index f3cc3f88..f1cd1c01 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py @@ -70,369 +70,375 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] response_body_json = """ { - "test" : { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" }, - "totalHits" : 12, - "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" + "totalHits" : 12, + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "minLatency" : 167, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "maxLatency" : 168, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "loss" : 0, - "protocol" : "tcp", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "ztaMetrics" : [ { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" }, { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" } ], - "roundId" : 1384309800, - "udpProbeMode" : "unknown", - "isIcmpBlocked" : true, - "avgLatency" : 167.04, - "tcpProbeMode" : "auto", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "jitter" : 0.076808, - "application" : "webex", - "serverIp" : "185.199.108.153", - "testId" : "584739201", - "webex" : { - "remoteSipSessionId" : "22581707460321454", - "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", - "conferenceId" : "225817074608419375", - "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", - "meetingApp" : "ZoomCRC" + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" }, - "aid" : "1234", - "errorDetails" : "Error" + "aid" : "1234", + "errorDetails" : "Error" }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "minLatency" : 167, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "maxLatency" : 168, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "loss" : 0, - "protocol" : "tcp", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "ztaMetrics" : [ { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" }, { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" } ], - "roundId" : 1384309800, - "udpProbeMode" : "unknown", - "isIcmpBlocked" : true, - "avgLatency" : 167.04, - "tcpProbeMode" : "auto", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "jitter" : 0.076808, - "application" : "webex", - "serverIp" : "185.199.108.153", - "testId" : "584739201", - "webex" : { - "remoteSipSessionId" : "22581707460321454", - "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", - "conferenceId" : "225817074608419375", - "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", - "meetingApp" : "ZoomCRC" + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" }, - "aid" : "1234", - "errorDetails" : "Error" + "aid" : "1234", + "errorDetails" : "Error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -479,7 +485,6 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -491,14 +496,21 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -545,7 +557,6 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -560,14 +571,21 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -614,7 +632,6 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -629,14 +646,21 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -683,7 +707,6 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -698,14 +721,21 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -752,7 +782,6 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -767,14 +796,21 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -821,7 +857,6 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -836,14 +871,21 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_dynamic_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + dynamic_endpoint_tests_data_round_search=dynamic_endpoint_tests_data_round_search, + _headers=self.te_headers("filter_dynamic_test_network_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -859,505 +901,510 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "test" : { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "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" + "_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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "udpProbeMode" : "unknown", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "tcpProbeMode" : "auto", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "protocol" : "tcp", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "application" : "webex", - "pathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "vpnPathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "webex" : { - "remoteSipSessionId" : "22581707460321454", - "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", - "conferenceId" : "225817074608419375", - "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", - "meetingApp" : "ZoomCRC" + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" }, - "aid" : "1234", - "roundId" : 1384309800 + "aid" : "1234", + "roundId" : 1384309800 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "udpProbeMode" : "unknown", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "tcpProbeMode" : "auto", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "protocol" : "tcp", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "application" : "webex", - "pathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "vpnPathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "webex" : { - "remoteSipSessionId" : "22581707460321454", - "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", - "conferenceId" : "225817074608419375", - "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", - "meetingApp" : "ZoomCRC" + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" }, - "aid" : "1234", - "roundId" : 1384309800 + "aid" : "1234", + "roundId" : 1384309800 } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1392,10 +1439,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1418,10 +1470,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1447,10 +1504,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1476,10 +1538,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1505,10 +1572,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1534,10 +1606,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1563,10 +1640,15 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dynamic_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_dynamic_test_path_vis_agent_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1584,376 +1666,383 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" }, - "endDate" : "2022-07-18T22:00:54Z", - "totalHits" : 12, - "_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" + "endDate" : "2022-07-18T22:00:54Z", + "totalHits" : 12, + "_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" + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "udpProbeMode" : "unknown", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "tcpProbeMode" : "auto", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "protocol" : "tcp", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "application" : "webex", - "pathTraces" : [ { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "location" : "San Francisco Area", - "webex" : { - "remoteSipSessionId" : "22581707460321454", - "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", - "conferenceId" : "225817074608419375", - "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", - "meetingApp" : "ZoomCRC" + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" }, - "aid" : "1234", - "roundId" : 1384309800 + "aid" : "1234", + "roundId" : 1384309800 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "udpProbeMode" : "unknown", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "tcpProbeMode" : "auto", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "protocol" : "tcp", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "application" : "webex", - "pathTraces" : [ { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "location" : "San Francisco Area", - "webex" : { - "remoteSipSessionId" : "22581707460321454", - "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", - "conferenceId" : "225817074608419375", - "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", - "meetingApp" : "ZoomCRC" + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" }, - "aid" : "1234", - "roundId" : 1384309800 + "aid" : "1234", + "roundId" : 1384309800 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1978,12 +2067,19 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2011,12 +2107,19 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2044,12 +2147,19 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2077,12 +2187,19 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2110,12 +2227,19 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2143,12 +2267,19 @@ class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dynamic_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_dynamic_test_path_vis_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py index 50b61984..4854b465 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py @@ -67,348 +67,354 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] response_body_json = """ { - "test" : { - "server" : "www.example.com", - "isSavedEvent" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + "test" : { + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" }, - "totalHits" : 12, - "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" + "totalHits" : 12, + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "isIcmpBlocked" : true, - "avgLatency" : 167.04, - "minLatency" : 167, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "maxLatency" : 168, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "loss" : 0, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "jitter" : 0.076808, - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "ztaMetrics" : [ { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" }, { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" } ], - "testId" : "584739201", - "aid" : "1234", - "roundId" : 1384309800, - "errorDetails" : "Error" + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "isIcmpBlocked" : true, - "avgLatency" : 167.04, - "minLatency" : 167, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "maxLatency" : 168, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "loss" : 0, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "jitter" : 0.076808, - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "ztaMetrics" : [ { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" }, { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" } ], - "testId" : "584739201", - "aid" : "1234", - "roundId" : 1384309800, - "errorDetails" : "Error" + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -452,7 +458,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -464,14 +469,21 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -515,7 +527,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -530,14 +541,21 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -581,7 +599,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -596,14 +613,21 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -647,7 +671,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -662,14 +685,21 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -713,7 +743,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -728,14 +757,21 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -779,7 +815,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -794,14 +829,21 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_scheduled_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + endpoint_tests_data_rounds_search=endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_test_network_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -848,300 +890,307 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] response_body_json = """ { - "totalHits" : 12, - "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" + "totalHits" : 12, + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "isIcmpBlocked" : true, - "avgLatency" : 167.04, - "minLatency" : 167, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "maxLatency" : 168, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "loss" : 0, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "jitter" : 0.076808, - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "ztaMetrics" : [ { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" }, { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" } ], - "testId" : "584739201", - "aid" : "1234", - "roundId" : 1384309800, - "errorDetails" : "Error" + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "isIcmpBlocked" : true, - "avgLatency" : 167.04, - "minLatency" : 167, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "maxLatency" : 168, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "score" : { - "applicationScore" : 100, - "quality" : "great" + "score" : { + "applicationScore" : 100, + "quality" : "great" }, - "loss" : 0, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "jitter" : 0.076808, - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "ztaMetrics" : [ { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" }, { - "loss" : 50, - "jitter" : 5, - "avgLatency" : 3, - "errorMessage" : "ERR_NAME_NOT_RESOLVED", - "type" : "zta_service" + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" } ], - "testId" : "584739201", - "aid" : "1234", - "roundId" : 1384309800, - "errorDetails" : "Error" + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1186,7 +1235,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1198,15 +1246,23 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1251,7 +1307,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -1266,15 +1321,23 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1319,7 +1382,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -1334,15 +1396,23 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1387,7 +1457,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -1402,15 +1471,23 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1455,7 +1532,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -1470,15 +1546,23 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1523,7 +1607,6 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) max = 5 cursor = 'cursor_example' use_all_permitted_aids = False - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] error_body_json = """ { "instance" : "instance", @@ -1538,15 +1621,23 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_scheduled_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + max=max, + cursor=cursor, + use_all_permitted_aids=use_all_permitted_aids, - expand=expand, + multi_test_id_endpoint_tests_data_rounds_search=multi_test_id_endpoint_tests_data_rounds_search, + _headers=self.te_headers("filter_scheduled_tests_network_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1562,484 +1653,489 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) aid = '1234' response_body_json = """ { - "test" : { - "server" : "www.example.com", - "isSavedEvent" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + "test" : { + "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" + "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" + "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 + "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 + "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 + "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" + "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" + "_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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "vpnPathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "aid" : "1234", - "roundId" : 1384309800 + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "vpnPathTraces" : [ { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "udpPathTraceMode" : "unknown", - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803", - "tcpPathTraceMode" : "syn-pcap" + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "aid" : "1234", - "roundId" : 1384309800 + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2062,10 +2158,15 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2091,10 +2192,15 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2120,10 +2226,15 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2149,10 +2260,15 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2178,10 +2294,15 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2207,10 +2328,15 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.get_scheduled_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_scheduled_test_path_vis_agent_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2228,354 +2354,361 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) cursor = 'cursor_example' response_body_json = """ { - "test" : { - "server" : "www.example.com", - "isSavedEvent" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + "test" : { + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" }, - "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" + "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" + "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" } }, - "results" : [ { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "location" : "San Francisco Area", - "aid" : "1234", - "roundId" : 1384309800 + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 }, { - "originalTargetProfile" : { - "protocol" : "tcp", - "remotePort" : 80, - "remoteIpAddress" : "120.98.134.7" + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" }, - "server" : "www.google.com:443", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "asnDetails" : { - "asName" : "ThousandEyes, Inc", - "asNumber" : 394101 + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 }, - "vpnProfile" : { - "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], - "vpnGatewayAddress" : "120.98.134.7", - "vpnType" : "cisco-anyconnect", - "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] }, - "batteryMetrics" : { - "batteryHealthNormalizedPercent" : 0.92, - "batteryLevel" : "medium", - "batteryLevelNormalizedPercent" : 0.3 + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 }, - "sourcePrefix" : "196.40.96.0/20", - "userProfile" : { - "userName" : "joeblogs32", - "userPrincipalName" : "joeblogs32@c.com" + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" }, - "platform" : "mac", - "cellularProfile" : { - "rssi" : -10, - "advertisedNetworkSubtype" : "LTE/HSPA", - "carrierName" : "T-Mobile", - "rsrq" : -30, - "rsrp" : -30, - "advertisedNetworkGen" : "2g, 3g, 4g, 5g", - "rscp" : -30, - "networkGen" : "2g, 3g, 4g, 5g", - "networkSubtype" : "LTE/HSPA", - "sinr" : 20 + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 }, - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" }, { - "protocol" : "tcp", - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "udpPathTraceMode" : "unknown", - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "tcpPathTraceMode" : "syn-pcap" + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" } ], - "serverIp" : "185.199.108.153", - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "testId" : "584739201", - "location" : "San Francisco Area", - "aid" : "1234", - "roundId" : 1384309800 + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2600,12 +2733,19 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2633,12 +2773,19 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2666,12 +2813,19 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2699,12 +2853,19 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2732,12 +2893,19 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2765,12 +2933,19 @@ class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.get_scheduled_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_scheduled_test_path_vis_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py index c333abea..1b69c9a9 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py @@ -61,119 +61,126 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): 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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "proxy" : { - "loss" : 0.1, - "jitter" : 46, - "latency" : 150, - "target" : "54.208.6.220" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "vpn" : { - "loss" : 0.1, - "jitter" : 46, - "latency" : 150, - "target" : "54.208.6.220" + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" }, - "destination" : { - "loss" : 0.1, - "jitter" : 46, - "latency" : 150, - "target" : "54.208.6.220" + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" }, - "id" : "07625:1490529480:aVDViw0i", - "roundId" : 1384309800 + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 }, { - "date" : "2022-07-17T22:00:54Z", - "proxy" : { - "loss" : 0.1, - "jitter" : 46, - "latency" : 150, - "target" : "54.208.6.220" + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "vpn" : { - "loss" : 0.1, - "jitter" : 46, - "latency" : 150, - "target" : "54.208.6.220" + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" }, - "destination" : { - "loss" : 0.1, - "jitter" : 46, - "latency" : 150, - "target" : "54.208.6.220" + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" }, - "id" : "07625:1490529480:aVDViw0i", - "roundId" : 1384309800 + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -232,12 +239,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -284,12 +298,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -339,12 +360,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -394,12 +422,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -449,12 +484,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -504,12 +546,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -559,12 +608,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_real_user_tests_network_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -604,59 +660,66 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): 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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "committed" : "2022-07-17T22:00:54Z", - "experienceScore" : 0.5, - "sourceAddress" : "84.255.241.1", - "organizationName" : "T-2 Access Network", - "visitedSite" : "www.thousandeyes.com", - "pageId" : "C31gBrYJ", - "protocol" : "https", - "numberOfPages" : 2, - "port" : 443, - "id" : "07625:1490529480:aVDViw0i", - "roundId" : 1384309800 + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 }, { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "committed" : "2022-07-17T22:00:54Z", - "experienceScore" : 0.5, - "sourceAddress" : "84.255.241.1", - "organizationName" : "T-2 Access Network", - "visitedSite" : "www.thousandeyes.com", - "pageId" : "C31gBrYJ", - "protocol" : "https", - "numberOfPages" : 2, - "port" : 443, - "id" : "07625:1490529480:aVDViw0i", - "roundId" : 1384309800 + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -715,12 +778,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -767,12 +837,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -822,12 +899,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -877,12 +961,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -932,12 +1023,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -987,12 +1085,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1042,12 +1147,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_real_user_tests_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + _headers=self.te_headers("filter_real_user_tests_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1085,101 +1197,108 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): 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" + "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" } }, - "results" : [ { - "pageTimings" : { - "onContentLoad" : 1483, - "onLoad" : 4569 + "results" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "pageTitle" : "Network Performance Resources | ThousandEyes", - "responseTime" : 240, - "pageUrl" : "https://app.thousandeyes.com/settings/integrations", - "id" : "07625:1490529480:aVDViw0i", - "pageId" : "C31gBrYJ", - "roundId" : 1384309800, - "loadDate" : "2022-07-17T22:00:54Z", - "responseCode" : 200 + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 }, { - "pageTimings" : { - "onContentLoad" : 1483, - "onLoad" : 4569 + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 }, - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "pageTitle" : "Network Performance Resources | ThousandEyes", - "responseTime" : 240, - "pageUrl" : "https://app.thousandeyes.com/settings/integrations", - "id" : "07625:1490529480:aVDViw0i", - "pageId" : "C31gBrYJ", - "roundId" : 1384309800, - "loadDate" : "2022-07-17T22:00:54Z", - "responseCode" : 200 + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1236,12 +1355,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1286,12 +1412,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1339,12 +1472,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1392,12 +1532,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1445,12 +1592,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1498,12 +1652,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1551,12 +1712,19 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_real_user_tests_visited_pages_results( + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1571,238 +1739,238 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "har" : { - "log" : { - "browser" : { - "name" : "Google Chrome", - "version" : "57.0.2987.98" + "har" : { + "log" : { + "browser" : { + "name" : "Google Chrome", + "version" : "57.0.2987.98" }, - "creator" : { - "name" : "ThousandEyes Endpoint Agent", - "version" : "0.47.0" + "creator" : { + "name" : "ThousandEyes Endpoint Agent", + "version" : "0.47.0" }, - "entries" : [ { - "pageref" : "page_1", - "request" : { - "headers" : [ { - "name" : "Upgrade-Insecure-Requests", - "value" : "1" + "entries" : [ { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "Upgrade-Insecure-Requests", + "value" : "1" }, { - "name" : "User-Agent", - "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" }, { - "name" : "Accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" + "name" : "Accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" }, { - "name" : "Referer", - "value" : "https://www.thousandeyes.com/" + "name" : "Referer", + "value" : "https://www.thousandeyes.com/" }, { - "name" : "Accept-Encoding", - "value" : "gzip, deflate, sdch, br" + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" }, { - "name" : "Accept-Language", - "value" : "en-US,en;q=0.6" + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" }, { - "name" : "Cookie", - "value" : "(removed)" + "name" : "Cookie", + "value" : "(removed)" } ], - "method" : "GET", - "queryString" : [ { - "name" : "locale", - "value" : "en-US" + "method" : "GET", + "queryString" : [ { + "name" : "locale", + "value" : "en-US" } ], - "url" : "https://www.thousandeyes.com/resources" + "url" : "https://www.thousandeyes.com/resources" }, - "response" : { - "bodySize" : 17776, - "content" : { - "mimeType" : "text/html;charset=ISO-8859-1", - "size" : 17776 + "response" : { + "bodySize" : 17776, + "content" : { + "mimeType" : "text/html;charset=ISO-8859-1", + "size" : 17776 }, - "headers" : [ { - "name" : "Content-Type", - "value" : "text/html;charset=ISO-8859-1" + "headers" : [ { + "name" : "Content-Type", + "value" : "text/html;charset=ISO-8859-1" }, { - "name" : "Content-Length", - "value" : "17776" + "name" : "Content-Length", + "value" : "17776" }, { - "name" : "Connection", - "value" : "keep-alive" + "name" : "Connection", + "value" : "keep-alive" }, { - "name" : "Date", - "value" : "Sun, 26 Mar 2017 11:58:54 GMT" + "name" : "Date", + "value" : "Sun, 26 Mar 2017 11:58:54 GMT" }, { - "name" : "Server", - "value" : "Apache" + "name" : "Server", + "value" : "Apache" }, { - "name" : "Cache-Control", - "value" : "max-age=600, must-revalidate" + "name" : "Cache-Control", + "value" : "max-age=600, must-revalidate" }, { - "name" : "Content-Language", - "value" : "en-US" + "name" : "Content-Language", + "value" : "en-US" }, { - "name" : "Content-Encoding", - "value" : "gzip" + "name" : "Content-Encoding", + "value" : "gzip" }, { - "name" : "X-Frame-Options", - "value" : "sameorigin" + "name" : "X-Frame-Options", + "value" : "sameorigin" }, { - "name" : "Strict-Transport-Security", - "value" : "max-age=31536000" + "name" : "Strict-Transport-Security", + "value" : "max-age=31536000" }, { - "name" : "Vary", - "value" : "Accept-Encoding" + "name" : "Vary", + "value" : "Accept-Encoding" }, { - "name" : "X-Cache", - "value" : "Miss from cloudfront" + "name" : "X-Cache", + "value" : "Miss from cloudfront" }, { - "name" : "Via", - "value" : "1.1 5dbe09af3a2c87121e31ffa67f174f66.cloudfront.net (CloudFront)" + "name" : "Via", + "value" : "1.1 5dbe09af3a2c87121e31ffa67f174f66.cloudfront.net (CloudFront)" }, { - "name" : "X-Amz-Cf-Id", - "value" : "YkvlkBNKgHt5aMu9vcS22Z8kHn1MUr-8adupwhDk3j9vF-TpSyIxZA==" + "name" : "X-Amz-Cf-Id", + "value" : "YkvlkBNKgHt5aMu9vcS22Z8kHn1MUr-8adupwhDk3j9vF-TpSyIxZA==" } ], - "headersSize" : 527, - "redirectURL" : "", - "status" : 200, - "statusText" : "OK" + "headersSize" : 527, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" }, - "serverIPAddress" : "13.32.22.80", - "startedDateTime" : "2017-03-22T11:58:54.123+02:00", - "time" : 177, - "timings" : { - "blocked" : -1, - "connect" : -1, - "dns" : -1, - "receive" : 27, - "send" : -1, - "ssl" : -1, - "wait" : 150 + "serverIPAddress" : "13.32.22.80", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 177, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 27, + "send" : -1, + "ssl" : -1, + "wait" : 150 } }, { - "pageref" : "page_1", - "request" : { - "headers" : [ { - "name" : "User-Agent", - "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" }, { - "name" : "Accept", - "value" : "*/*" + "name" : "Accept", + "value" : "*/*" }, { - "name" : "Referer", - "value" : "https://www.thousandeyes.com/resources" + "name" : "Referer", + "value" : "https://www.thousandeyes.com/resources" }, { - "name" : "Accept-Encoding", - "value" : "gzip, deflate, sdch, br" + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" }, { - "name" : "Accept-Language", - "value" : "en-US,en;q=0.6" + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" } ], - "method" : "GET", - "queryString" : [ ], - "url" : "https://use.typekit.net/cjy5myw.js" + "method" : "GET", + "queryString" : [ ], + "url" : "https://use.typekit.net/cjy5myw.js" }, - "response" : { - "bodySize" : 0, - "content" : { - "mimeType" : "text/javascript;charset=utf-8", - "size" : 7814 + "response" : { + "bodySize" : 0, + "content" : { + "mimeType" : "text/javascript;charset=utf-8", + "size" : 7814 }, - "headers" : [ { - "name" : "status", - "value" : "200" + "headers" : [ { + "name" : "status", + "value" : "200" }, { - "name" : "access-control-allow-origin", - "value" : "*" + "name" : "access-control-allow-origin", + "value" : "*" }, { - "name" : "cache-control", - "value" : "public, max-age=600, stale-while-revalidate=604800" + "name" : "cache-control", + "value" : "public, max-age=600, stale-while-revalidate=604800" }, { - "name" : "content-encoding", - "value" : "gzip" + "name" : "content-encoding", + "value" : "gzip" }, { - "name" : "content-type", - "value" : "text/javascript;charset=utf-8" + "name" : "content-type", + "value" : "text/javascript;charset=utf-8" }, { - "name" : "server", - "value" : "nginx" + "name" : "server", + "value" : "nginx" }, { - "name" : "status", - "value" : "200 OK" + "name" : "status", + "value" : "200 OK" }, { - "name" : "timing-allow-origin", - "value" : "*" + "name" : "timing-allow-origin", + "value" : "*" }, { - "name" : "vary", - "value" : "Accept-Encoding" + "name" : "vary", + "value" : "Accept-Encoding" }, { - "name" : "content-length", - "value" : "7814" + "name" : "content-length", + "value" : "7814" }, { - "name" : "date", - "value" : "Sun, 26 Mar 2017 11:58:43 GMT" + "name" : "date", + "value" : "Sun, 26 Mar 2017 11:58:43 GMT" } ], - "headersSize" : 334, - "redirectURL" : "", - "status" : 200, - "statusText" : "OK" + "headersSize" : 334, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" }, - "serverIPAddress" : "104.103.103.234", - "startedDateTime" : "2017-03-22T11:58:54.123+02:00", - "time" : 72, - "timings" : { - "blocked" : -1, - "connect" : -1, - "dns" : -1, - "receive" : 10, - "send" : -1, - "ssl" : -1, - "wait" : 62 + "serverIPAddress" : "104.103.103.234", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 72, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 10, + "send" : -1, + "ssl" : -1, + "wait" : 62 } } ], - "pages" : [ { - "id" : "page_1", - "pageTimings" : { - "onContentLoad" : 874, - "onLoad" : 3492 + "pages" : [ { + "id" : "page_1", + "pageTimings" : { + "onContentLoad" : 874, + "onLoad" : 3492 }, - "responseCode" : 200, - "startedDateTime" : "2017-03-22T11:58:54.123+02:00", - "title" : "Network Performance Resources | ThousandEyes" + "responseCode" : 200, + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "title" : "Network Performance Resources | ThousandEyes" } ], - "version" : "1.2", - "systemMetrics" : { - "startTimeMs" : 1581508857327, - "endTimeMs" : 1581508867333, - "cpuUtilization" : { - "min" : 0.30859375, - "max" : 0.5625, - "mean" : 0.38931831001805056, - "median" : 0.353515625, - "stdDev" : 0.08389194281742307, - "count" : 10 + "version" : "1.2", + "systemMetrics" : { + "startTimeMs" : 1581508857327, + "endTimeMs" : 1581508867333, + "cpuUtilization" : { + "min" : 0.30859375, + "max" : 0.5625, + "mean" : 0.38931831001805056, + "median" : 0.353515625, + "stdDev" : 0.08389194281742307, + "count" : 10 }, - "physicalMemoryUsedBytes" : { - "min" : 12805128192, - "max" : 12825530368, - "mean" : 1.281914582109091E10, - "median" : 12818219008, - "stdDev" : 5741124.05691331, - "count" : 11 + "physicalMemoryUsedBytes" : { + "min" : 12805128192, + "max" : 12825530368, + "mean" : 1.281914582109091E10, + "median" : 12818219008, + "stdDev" : 5741124.05691331, + "count" : 11 }, - "physicalMemoryTotalBytes" : 17069891584 + "physicalMemoryTotalBytes" : 17069891584 } } } @@ -1810,9 +1978,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): """ expected_response = json.loads(response_body_json) response = self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1834,9 +2006,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1861,9 +2037,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1888,9 +2068,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1915,9 +2099,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1942,9 +2130,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1969,9 +2161,13 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_real_user_test_page_results( + id=id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_real_user_test_page_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1985,415 +2181,418 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "committed" : "2022-07-17T22:00:54Z", - "experienceScore" : 0.5, - "sourceAddress" : "84.255.241.1", - "organizationName" : "T-2 Access Network", - "visitedSite" : "www.thousandeyes.com", - "coordinates" : { - "latitude" : 46.0552778, - "location" : "Slovenia", - "longitude" : 14.5144444 + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 }, - "network" : { - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "isIcmpBlocked" : true, - "vpnPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "ping" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "traceroute" : { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "vpnTraceroute" : { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "connectRtt" : 77.777, - "gatewayPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "errors" : [ "ping: Request timed out before getting response" ] + "errors" : [ "ping: Request timed out before getting response" ] }, - "protocol" : "https", - "pages" : [ { - "pageTimings" : { - "onContentLoad" : 1483, - "onLoad" : 4569 + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 }, - "pageTitle" : "Network Performance Resources | ThousandEyes", - "pageUrl" : "https://app.thousandeyes.com/settings/integrations", - "pageId" : "C31gBrYJ", - "loadDate" : "2022-07-17T22:00:54Z", - "responseCode" : 200 + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 }, { - "pageTimings" : { - "onContentLoad" : 1483, - "onLoad" : 4569 + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 }, - "pageTitle" : "Network Performance Resources | ThousandEyes", - "pageUrl" : "https://app.thousandeyes.com/settings/integrations", - "pageId" : "C31gBrYJ", - "loadDate" : "2022-07-17T22:00:54Z", - "responseCode" : 200 + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 } ], - "numberOfPages" : 2, - "port" : 443, - "browser" : { - "name" : "Google Chrome", - "version" : "116.0.0.0" + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" }, - "id" : "07625:1490529480:aVDViw0i", - "roundId" : 1384309800 + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 }, { - "date" : "2022-07-17T22:00:54Z", - "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", - "committed" : "2022-07-17T22:00:54Z", - "experienceScore" : 0.5, - "sourceAddress" : "84.255.241.1", - "organizationName" : "T-2 Access Network", - "visitedSite" : "www.thousandeyes.com", - "coordinates" : { - "latitude" : 46.0552778, - "location" : "Slovenia", - "longitude" : 14.5144444 + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 }, - "network" : { - "systemMetrics" : { - "cpuUtilization" : { - "min" : 0.22, - "median" : 0.61, - "max" : 0.75, - "mean" : 0.55, - "count" : 150, - "stdDev" : 0.01 + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 }, - "physicalMemoryTotalBytes" : 1024, - "startTimeMs" : 1581508857327, - "physicalMemoryUsedBytes" : { - "min" : 1.2, - "median" : 1.85, - "max" : 2.5, - "mean" : 1.77, - "count" : 155, - "stdDev" : 0.25 + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 }, - "endTimeMs" : 1581508867333 + "endTimeMs" : 1581508867333 }, - "isIcmpBlocked" : true, - "vpnPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "ping" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "networkProfile" : { - "previousInterface" : { - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "interfaceName" : "en0", - "subnetMask" : "255.255.255.0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] }, - "ethernetProfile" : { - "linkSpeed" : 860 + "ethernetProfile" : { + "linkSpeed" : 860 }, - "publicIpAddress" : "84.255.241.1", - "publicIpRange" : "84.255.241.0-84.255.241.255", - "ipAddress" : "10.0.0.13", - "hardwareType" : "wireless", - "localPrefix" : "10.0.0.0", - "proxyProfile" : { - "method" : "System", - "proxies" : [ { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" }, { - "bypass" : "*.local;169.254/16", - "proxy" : "<direct>" + "bypass" : "*.local;169.254/16", + "proxy" : "" } ] }, - "subnetMask" : "255.255.255.0", - "error" : "An operation timed out.", - "wirelessProfile" : { - "rssi" : -38, - "bssid" : "4c:ba:ba:f4:fa:fa", - "snr" : 57, - "vendor" : "Cisco", - "txRate" : 130, - "channel" : 1, - "noise" : -95, - "phyMode" : "802.11n", - "ssid" : "Internet for the masses", - "quality" : 100 + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 }, - "interfaceName" : "en0", - "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], - "gateway" : "10.0.0.1" + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" }, - "traceroute" : { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "vpnTraceroute" : { - "destination" : "13.32.22.232", - "hops" : [ { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 }, { - "delay" : 5, - "prefix" : "196.40.96.0/20", - "hop" : 1, - "ipAddress" : "196.40.106.237", - "name" : "89-210-88-65.access.t-2.net", - "mpls" : [ "L=301472,E=0,S=1,T=1" ], - "asn" : 34779 + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 } ], - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] }, - "connectRtt" : 77.777, - "gatewayPing" : { - "maxRtt" : 66, - "loss" : 1, - "pktsReceived" : 10, - "avgRtt" : 7, - "meanDevRtt" : 11, - "minRtt" : 1, - "error" : "An operation timed out.", - "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], - "pktsSent" : 10 + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 }, - "errors" : [ "ping: Request timed out before getting response" ] + "errors" : [ "ping: Request timed out before getting response" ] }, - "protocol" : "https", - "pages" : [ { - "pageTimings" : { - "onContentLoad" : 1483, - "onLoad" : 4569 + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 }, - "pageTitle" : "Network Performance Resources | ThousandEyes", - "pageUrl" : "https://app.thousandeyes.com/settings/integrations", - "pageId" : "C31gBrYJ", - "loadDate" : "2022-07-17T22:00:54Z", - "responseCode" : 200 + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 }, { - "pageTimings" : { - "onContentLoad" : 1483, - "onLoad" : 4569 + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 }, - "pageTitle" : "Network Performance Resources | ThousandEyes", - "pageUrl" : "https://app.thousandeyes.com/settings/integrations", - "pageId" : "C31gBrYJ", - "loadDate" : "2022-07-17T22:00:54Z", - "responseCode" : 200 + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 } ], - "numberOfPages" : 2, - "port" : 443, - "browser" : { - "name" : "Google Chrome", - "version" : "116.0.0.0" + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" }, - "id" : "07625:1490529480:aVDViw0i", - "roundId" : 1384309800 + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2414,8 +2613,11 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2439,8 +2641,11 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2464,8 +2669,11 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2489,8 +2697,11 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2514,8 +2725,11 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2539,8 +2753,11 @@ class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_real_user_test_results( + id=id, + aid=aid, + _headers=self.te_headers("get_real_user_test_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py index a8a0da2f..bb4673f4 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py @@ -54,58 +54,61 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" } """ expected_response = json.loads(response_body_json) response = self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -157,8 +160,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -198,8 +204,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -242,8 +251,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -286,8 +298,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -330,8 +345,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -374,8 +392,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -418,8 +439,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_agent_to_server_endpoint_dynamic_test( + dynamic_test_request=dynamic_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -432,8 +456,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): test_id = '584739201' aid = '1234' response = self.api.delete_agent_to_server_endpoint_dynamic_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test"), ) self.assertEqual(204, response.status_code) @@ -467,8 +494,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -489,8 +519,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -514,8 +547,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -539,8 +575,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -564,8 +603,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -589,8 +631,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -614,8 +659,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -629,58 +677,61 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" } """ expected_response = json.loads(response_body_json) response = self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -701,8 +752,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -726,8 +780,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -751,8 +808,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -776,8 +836,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -801,8 +864,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -826,8 +892,11 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -840,118 +909,120 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "tests" : [ { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" }, { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "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" + "_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_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -971,7 +1042,9 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -994,7 +1067,9 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1017,7 +1092,9 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1040,7 +1117,9 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1063,7 +1142,9 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_server_endpoint_dynamic_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1090,59 +1171,63 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "hasPing" : true, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" }, { - "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-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" + "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, - "tcpProbeMode" : "auto", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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", - "application" : "webex", - "hasTraceroute" : true, - "isEnabled" : true, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "aid" : "1234", - "agentSelectorConfig" : { - "agentSelectorType" : "all-agents", - "maxMachines" : 25 + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" } """ expected_response = json.loads(response_body_json) response = self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1188,9 +1273,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1224,9 +1313,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1263,9 +1356,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1302,9 +1399,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1341,9 +1442,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1380,9 +1485,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1419,9 +1528,13 @@ class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_agent_to_server_endpoint_dynamic_test( + test_id=test_id, + endpoint_dynamic_test_update=endpoint_dynamic_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py index 0832178d..33fd5cb7 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py @@ -54,59 +54,62 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) 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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" } """ expected_response = json.loads(response_body_json) response = self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -158,8 +161,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(400) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -199,8 +205,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -243,8 +252,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -287,8 +299,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -331,8 +346,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -375,8 +393,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -419,8 +440,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.create_agent_to_server_endpoint_scheduled_test( + endpoint_agent_to_server_test_request=endpoint_agent_to_server_test_request, + aid=aid, + _headers=self.te_headers("create_agent_to_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -433,8 +457,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) test_id = '584739201' aid = '1234' response = self.api.delete_agent_to_server_endpoint_scheduled_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test"), ) self.assertEqual(204, response.status_code) @@ -468,8 +495,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -490,8 +520,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -515,8 +548,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -540,8 +576,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -565,8 +604,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -590,8 +632,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -615,8 +660,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -630,59 +678,62 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) 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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" } """ expected_response = json.loads(response_body_json) response = self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -703,8 +754,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -728,8 +782,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -753,8 +810,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -778,8 +838,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -803,8 +866,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -828,8 +894,11 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -842,120 +911,122 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) 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" + "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" + "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" + "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 + "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 + "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 + "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" + "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" + "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" + "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" + "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 + "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 + "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 + "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" + "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" + "_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_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -975,7 +1046,9 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -998,7 +1071,9 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1021,7 +1096,9 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1044,7 +1121,9 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1067,7 +1146,9 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_endpoint_scheduled_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1095,60 +1176,64 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) 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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "testName" : "Test name" } """ expected_response = json.loads(response_body_json) response = self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1195,9 +1280,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(400) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1232,9 +1321,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(401) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1272,9 +1365,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(403) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1312,9 +1409,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(404) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1352,9 +1453,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(429) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1392,9 +1497,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(500) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1432,9 +1541,13 @@ class TestAgentToServerEndpointScheduledTestsApiIntegration(IntegrationTestBase) ApiException.exception_class_for_http_status(502) ) as context: self.api.update_agent_to_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_network_test_update=endpoint_network_test_update, + aid=aid, + _headers=self.te_headers("update_agent_to_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py index 108dd3e9..f64c4578 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py @@ -34,36 +34,38 @@ class TestEndpointRealUserTestsApiIntegration(IntegrationTestBase): 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" ] + "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" + "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" ] + "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" + "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) @@ -83,7 +85,9 @@ class TestEndpointRealUserTestsApiIntegration(IntegrationTestBase): 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) @@ -106,7 +110,9 @@ class TestEndpointRealUserTestsApiIntegration(IntegrationTestBase): 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) @@ -129,7 +135,9 @@ class TestEndpointRealUserTestsApiIntegration(IntegrationTestBase): 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) @@ -152,7 +160,9 @@ class TestEndpointRealUserTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py index 9d5dc743..ac442bfa 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py @@ -34,120 +34,122 @@ class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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 + "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 + "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 + "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" + "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" + "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" + "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" + "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 + "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 + "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 + "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" + "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" + "_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) @@ -167,7 +169,9 @@ class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -190,7 +194,9 @@ class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -213,7 +219,9 @@ class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -236,7 +244,9 @@ class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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) @@ -259,7 +269,9 @@ class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py index c981d73b..27b916f1 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py @@ -64,70 +64,73 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" } """ expected_response = json.loads(response_body_json) response = self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -189,8 +192,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -240,8 +246,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -294,8 +303,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -348,8 +360,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -402,8 +417,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -456,8 +474,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -510,8 +531,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_http_server_endpoint_scheduled_test( + endpoint_http_server_test_request=endpoint_http_server_test_request, + aid=aid, + _headers=self.te_headers("create_http_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -524,8 +548,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): test_id = '584739201' aid = '1234' response = self.api.delete_http_server_endpoint_scheduled_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test"), ) self.assertEqual(204, response.status_code) @@ -559,8 +586,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -581,8 +611,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -606,8 +639,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -631,8 +667,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -656,8 +695,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -681,8 +723,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -706,8 +751,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -721,70 +769,73 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" } """ expected_response = json.loads(response_body_json) response = self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -805,8 +856,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -830,8 +884,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -855,8 +912,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -880,8 +940,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -905,8 +968,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -930,8 +996,11 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_http_server_endpoint_scheduled_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -944,142 +1013,144 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "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" + "tests" : [ { + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" }, { - "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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" } ], - "_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" + "_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_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1099,7 +1170,9 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1122,7 +1195,9 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1145,7 +1220,9 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1168,7 +1245,9 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1191,7 +1270,9 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_http_server_endpoint_scheduled_tests( + aid=aid, + _headers=self.te_headers("get_http_server_endpoint_scheduled_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1218,71 +1299,75 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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 + "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 + "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 + "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" + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" } """ expected_response = json.loads(response_body_json) response = self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1328,9 +1413,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1364,9 +1453,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1403,9 +1496,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1442,9 +1539,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1481,9 +1582,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1520,9 +1625,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1559,9 +1668,13 @@ class TestHTTPServerEndpointScheduledTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_http_server_endpoint_scheduled_test( + test_id=test_id, + endpoint_http_test_update=endpoint_http_test_update, + aid=aid, + _headers=self.te_headers("update_http_server_endpoint_scheduled_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-event-detection/test/test_events_api_integration.py b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py index 81cdb18c..f301b81b 100644 --- a/thousandeyes-sdk-event-detection/test/test_events_api_integration.py +++ b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py @@ -35,141 +35,144 @@ class TestEventsApiIntegration(IntegrationTestBase): 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" + "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" + "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" + "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" + "name" : "Google test", + "testType" : "agent-to-server", + "testId" : "226770" } ], - "inAccountGroup" : 2 + "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" + "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" + "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" + "affectedAgentIds" : [ "2954", "2953" ], + "ip" : "216.239.32.10", + "name" : "google.com", + "affectedTestIds" : [ "123", "1234" ], + "serverId" : "123" } ] }, - "type" : "target", - "grouping" : { - "target" : "google.com" + "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" + "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" + "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" + "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" + "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" + "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) @@ -190,8 +193,11 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -215,8 +221,11 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -240,8 +249,11 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -265,8 +277,11 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -290,8 +305,11 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -315,8 +333,11 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -335,111 +356,119 @@ class TestEventsApiIntegration(IntegrationTestBase): 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" + "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" + "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 + "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" + "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 + "typeName" : "Network Issue", + "title" : "Affecting destinations in google.com", + "type" : "target", + "affectedTargets" : { + "total" : 5, + "inAccountGroup" : 2 }, - "affectedAgents" : { - "total" : 5, - "inAccountGroup" : 2 + "affectedAgents" : { + "total" : 5, + "inAccountGroup" : 2 }, - "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", - "state" : "resolved", - "startDate" : "2020-04-23T13:43:16Z" + "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 + "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" + "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 + "typeName" : "Network Issue", + "title" : "Affecting destinations in google.com", + "type" : "target", + "affectedTargets" : { + "total" : 5, + "inAccountGroup" : 2 }, - "affectedAgents" : { - "total" : 5, - "inAccountGroup" : 2 + "affectedAgents" : { + "total" : 5, + "inAccountGroup" : 2 }, - "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", - "state" : "resolved", - "startDate" : "2020-04-23T13:43:16Z" + "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) @@ -477,13 +506,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -509,13 +546,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -544,13 +589,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -579,13 +632,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -614,13 +675,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -649,13 +718,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) @@ -684,13 +761,21 @@ class TestEventsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py index 1602eeaf..117ba1ff 100644 --- a/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py @@ -90,125 +90,126 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "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) @@ -275,7 +276,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -299,9 +299,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -368,7 +370,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -380,9 +381,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -449,7 +452,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -464,9 +466,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -533,7 +537,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -548,9 +551,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -617,7 +622,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -632,9 +636,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -701,7 +707,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -716,9 +721,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -785,7 +792,6 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -800,9 +806,11 @@ class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py index 83febcd6..1601027b 100644 --- a/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py @@ -91,126 +91,127 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "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" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "name" : "Account name", + "aid" : "1234" } ], - "pingPayloadSize" : 112, - "continuousMode" : false + "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) @@ -278,7 +279,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -302,9 +302,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -372,7 +374,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -384,9 +385,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -454,7 +457,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -469,9 +471,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -539,7 +543,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -554,9 +557,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -624,7 +629,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -639,9 +643,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -709,7 +715,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -724,9 +729,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -794,7 +801,6 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -809,9 +815,11 @@ class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py index 1f8772a1..40cd1176 100644 --- a/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py @@ -190,225 +190,226 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "credentials" : [ "3247", "1051" ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "requests" : [ { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" }, { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" } ], - "type" : "api", - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "protocol" : "tcp", - "collectProxyNetworkData" : false, - "followRedirects" : true, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "clientCertDomainsAllowList" : "www.thousandeyes.com", - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "overrideAgentProxy" : false, - "predefinedVariables" : [ { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" }, { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" } ], - "liveShare" : false, - "distributedTracing" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 19, - "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" + "timeLimit" : 19, + "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" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersionId" : "0", - "targetTime" : 1 + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 } """ expected_response = json.loads(response_body_json) response = self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -575,7 +576,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -599,9 +599,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -768,7 +770,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -780,9 +781,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -949,7 +952,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -964,9 +966,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1133,7 +1137,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1148,9 +1151,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1317,7 +1322,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1332,9 +1336,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1501,7 +1507,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1516,9 +1521,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1685,7 +1692,6 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): """ api_instant_test_request = thousandeyes_sdk.instant_tests.models.ApiInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1700,9 +1706,11 @@ class TestAPIInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_api_instant_test( + api_instant_test_request=api_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_instant_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py index 12b0c892..51c0d619 100644 --- a/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py @@ -91,132 +91,133 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "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" + "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" + "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" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "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) @@ -284,7 +285,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -308,9 +308,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -378,7 +380,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -390,9 +391,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -460,7 +463,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -475,9 +477,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -545,7 +549,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -560,9 +563,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -630,7 +635,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -645,9 +649,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -715,7 +721,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -730,9 +735,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -800,7 +807,6 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -815,9 +821,11 @@ class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py index 7c6179a9..890a5303 100644 --- a/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py @@ -80,115 +80,116 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "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" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "name" : "Account name", + "aid" : "1234" } ], - "testName" : "ThousandEyes Test" + "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) @@ -245,7 +246,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -269,9 +269,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -328,7 +330,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -340,9 +341,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -399,7 +402,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -414,9 +416,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -473,7 +477,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -488,9 +491,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -547,7 +552,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -562,9 +566,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -621,7 +627,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -636,9 +641,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -695,7 +702,6 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -710,9 +716,11 @@ class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py index 796c6d4a..fa8372bb 100644 --- a/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py @@ -79,114 +79,115 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "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" + "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" + "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 + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "name" : "Account name", + "aid" : "1234" } ], - "testName" : "ThousandEyes Test" + "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) @@ -242,7 +243,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -266,9 +266,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -324,7 +326,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -336,9 +337,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -394,7 +397,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -409,9 +411,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -467,7 +471,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -482,9 +485,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -540,7 +545,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -555,9 +559,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -613,7 +619,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -628,9 +633,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -686,7 +693,6 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -701,9 +707,11 @@ class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py index 2ee0292b..4065b5a5 100644 --- a/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py @@ -95,130 +95,131 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "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" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "name" : "Account name", + "aid" : "1234" } ], - "useActiveFtp" : false, - "username" : "username" + "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) @@ -290,7 +291,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -314,9 +314,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -388,7 +390,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -400,9 +401,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -474,7 +477,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -489,9 +491,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -563,7 +567,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -578,9 +581,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -652,7 +657,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -667,9 +671,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -741,7 +747,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -756,9 +761,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -830,7 +837,6 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -845,9 +851,11 @@ class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py index b01ae095..00a3de6c 100644 --- a/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py @@ -154,189 +154,190 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "page-load", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "pageLoadTargetTime" : 10, - "numPathTraces" : 3, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "pageLoadTimeLimit" : 10, - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -467,7 +468,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -491,9 +491,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -624,7 +626,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -636,9 +637,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -769,7 +772,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -784,9 +786,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -917,7 +921,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -932,9 +935,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1065,7 +1070,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1080,9 +1084,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1213,7 +1219,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1228,9 +1233,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1361,7 +1368,6 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): """ page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1376,9 +1382,11 @@ class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_page_load_instant_test( + page_load_instant_test_request=page_load_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_instant_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py index 75a37408..b01cbdae 100644 --- a/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py @@ -146,181 +146,182 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "http-server", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "contentRegex" : "(regex)+", - "testName" : "ThousandEyes Test", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "ipv6Policy" : "use-agent-policy", - "downloadLimit" : 2048, - "requestMethod" : "get", - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "headers" : [ "header1: value1", "header2: value2" ], - "numPathTraces" : 3, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "postBody" : "{ \"example\" : \"value\"}", - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -443,7 +444,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -467,9 +467,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -592,7 +594,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -604,9 +605,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -729,7 +732,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -744,9 +746,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -869,7 +873,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -884,9 +887,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1009,7 +1014,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1024,9 +1028,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1149,7 +1155,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1164,9 +1169,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1289,7 +1296,6 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): """ http_server_instant_test_request = thousandeyes_sdk.instant_tests.models.HttpServerInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1304,9 +1310,11 @@ class TestHTTPServerInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_http_server_instant_test( + http_server_instant_test_request=http_server_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_instant_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py index 290e480f..96614a41 100644 --- a/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py @@ -96,129 +96,130 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "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" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "name" : "Account name", + "aid" : "1234" } ], - "user" : "username" + "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) @@ -291,7 +292,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -315,9 +315,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -390,7 +392,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -402,9 +403,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -477,7 +480,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -492,9 +494,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -567,7 +571,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -582,9 +585,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -657,7 +662,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -672,9 +676,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -747,7 +753,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -762,9 +767,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -837,7 +844,6 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -852,9 +858,11 @@ class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py index 4d38f339..b441e773 100644 --- a/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py @@ -86,121 +86,122 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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 + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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" + "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" + "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) @@ -263,7 +264,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -287,9 +287,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -352,7 +354,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -364,9 +365,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -429,7 +432,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -444,9 +446,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -509,7 +513,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -524,9 +527,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -589,7 +594,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -604,9 +608,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -669,7 +675,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -684,9 +689,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) @@ -749,7 +756,6 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): """ 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", @@ -764,9 +770,11 @@ class TestVoiceInstantTestsApiIntegration(IntegrationTestBase): 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) diff --git a/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py index 8c03e305..7535eb44 100644 --- a/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py +++ b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py @@ -156,191 +156,192 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "web-transactions", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "credentials" : [ "3247", "1051" ], - "downloadLimit" : 2048, - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "numPathTraces" : 3, - "transactionScript" : "if (true) { return true; }", - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 30, - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username", - "targetTime" : 1 + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 } """ expected_response = json.loads(response_body_json) response = self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -473,7 +474,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -497,9 +497,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -632,7 +634,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -644,9 +645,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -779,7 +782,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -794,9 +796,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -929,7 +933,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -944,9 +947,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1079,7 +1084,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1094,9 +1098,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1229,7 +1235,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1244,9 +1249,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1379,7 +1386,6 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): """ web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1394,9 +1400,11 @@ class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_web_transaction_instant_test( + web_transaction_instant_test_request=web_transaction_instant_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transaction_instant_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py b/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py index ccf660a3..689bbf01 100644 --- a/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py +++ b/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py @@ -47,71 +47,74 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "providers" : [ { - "interfacesCount" : 15, - "locationsCount" : 50, - "_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" + "providers" : [ { + "interfacesCount" : 15, + "locationsCount" : 50, + "_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" } }, - "countriesCount" : 2, - "dataType" : "Application", - "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", - "region" : "North America", - "asnsCount" : 10, - "included" : true, - "providerName" : "Amazon Web Services", - "providerType" : "IAAS" + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" }, { - "interfacesCount" : 15, - "locationsCount" : 50, - "_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" + "interfacesCount" : 15, + "locationsCount" : 50, + "_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" } }, - "countriesCount" : 2, - "dataType" : "Application", - "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", - "region" : "North America", - "asnsCount" : 10, - "included" : true, - "providerName" : "Amazon Web Services", - "providerType" : "IAAS" + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" } ] } """ expected_response = json.loads(response_body_json) response = self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -156,8 +159,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -190,8 +196,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -227,8 +236,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -264,8 +276,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -301,8 +316,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -338,8 +356,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -375,8 +396,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_catalog_providers( + api_catalog_provider_filter=api_catalog_provider_filter, + aid=aid, + _headers=self.te_headers("filter_catalog_providers", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -390,43 +414,46 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "dataType" : "Application", - "asns" : [ { - "name" : "LVLT-1 - Level 3 Communications, Inc.", - "id" : 1 + "dataType" : "Application", + "asns" : [ { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 }, { - "name" : "LVLT-1 - Level 3 Communications, Inc.", - "id" : 1 + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 } ], - "locations" : [ { - "interfacesCount" : 5, - "location" : "San Jose, US" + "locations" : [ { + "interfacesCount" : 5, + "location" : "San Jose, US" }, { - "interfacesCount" : 5, - "location" : "San Jose, US" + "interfacesCount" : 5, + "location" : "San Jose, US" } ], - "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", - "region" : "North America", - "providerName" : "Amazon Web Services", - "providerType" : "IAAS" + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" } """ expected_response = json.loads(response_body_json) response = self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -459,8 +486,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -481,8 +511,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -506,8 +539,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -531,8 +567,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -556,8 +595,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -581,8 +623,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -606,8 +651,11 @@ class TestInternetInsightsCatalogProvidersApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_catalog_provider( + provider_id=provider_id, + aid=aid, + _headers=self.te_headers("get_catalog_provider", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py b/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py index 765de76e..cd7d3990 100644 --- a/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py +++ b/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py @@ -47,81 +47,84 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "outages" : [ { - "affectedInterfacesCount" : 1, - "endDate" : "2022-03-01T23:31:11Z", - "_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" + "outages" : [ { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_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" } }, - "affectedLocationsCount" : 1, - "endRoundId" : 1646177700, - "affectedTestsCount" : 1, - "type" : "app", - "providerType" : "SAAS", - "duration" : 214, - "startRoundId" : 1646177400, - "name" : "Google", - "id" : "xxxxxxxxxxxxxxxxxx1", - "affectedServersCount" : 2, - "asn" : 19994, - "providerName" : "Google", - "startDate" : "2022-03-01T23:31:11Z" + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" }, { - "affectedInterfacesCount" : 1, - "endDate" : "2022-03-01T23:31:11Z", - "_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" + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_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" } }, - "affectedLocationsCount" : 1, - "endRoundId" : 1646177700, - "affectedTestsCount" : 1, - "type" : "app", - "providerType" : "SAAS", - "duration" : 214, - "startRoundId" : 1646177400, - "name" : "Google", - "id" : "xxxxxxxxxxxxxxxxxx1", - "affectedServersCount" : 2, - "asn" : 19994, - "providerName" : "Google", - "startDate" : "2022-03-01T23:31:11Z" + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" } ] } """ expected_response = json.loads(response_body_json) response = self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -166,8 +169,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -200,8 +206,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -237,8 +246,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -274,8 +286,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -311,8 +326,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -348,8 +366,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -385,8 +406,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.filter_outages( + api_outage_filter=api_outage_filter, + aid=aid, + _headers=self.te_headers("filter_outages", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -400,68 +424,71 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "affectedDomains" : [ "amazon.com", "amazon.com" ], - "affectedTests" : [ { - "name" : "amazon-test2", - "id" : 5 + "affectedDomains" : [ "amazon.com", "amazon.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 }, { - "name" : "amazon-test2", - "id" : 5 + "name" : "amazon-test2", + "id" : 5 } ], - "endDate" : "2023-01-27T20:53:51.256Z", - "_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" + "endDate" : "2023-01-27T20:53:51.256Z", + "_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" } }, - "endRoundId" : 1674852600, - "providerType" : "SAAS", - "duration" : 180, - "startRoundId" : 1674852600, - "affectedAgents" : [ { - "name" : "London, England", - "id" : 11 + "endRoundId" : 1674852600, + "providerType" : "SAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 }, { - "name" : "London, England", - "id" : 11 + "name" : "London, England", + "id" : 11 } ], - "id" : "0CC4C4209887126DE42E92252FB43962CBB3193147F318EA", - "providerName" : "Amazon Web Services", - "applicationName" : "Amazon Web Services", - "startDate" : "2023-01-27T20:50:51.256Z", - "errors" : [ "HTTP_SERVER_TIMEOUT", "HTTP_SERVER_TIMEOUT" ], - "affectedLocations" : [ { - "location" : "Chicago, Illinois, US", - "affectedServers" : [ { - "prefix" : "123.176.185.0/23", - "domain" : "amazon.com" + "id" : "0CC4C4209887126DE42E92252FB43962CBB3193147F318EA", + "providerName" : "Amazon Web Services", + "applicationName" : "Amazon Web Services", + "startDate" : "2023-01-27T20:50:51.256Z", + "errors" : [ "HTTP_SERVER_TIMEOUT", "HTTP_SERVER_TIMEOUT" ], + "affectedLocations" : [ { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" }, { - "prefix" : "123.176.185.0/23", - "domain" : "amazon.com" + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" } ] }, { - "location" : "Chicago, Illinois, US", - "affectedServers" : [ { - "prefix" : "123.176.185.0/23", - "domain" : "amazon.com" + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" }, { - "prefix" : "123.176.185.0/23", - "domain" : "amazon.com" + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" } ] } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -494,8 +521,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -516,8 +546,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -541,8 +574,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -566,8 +602,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -591,8 +630,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -616,8 +658,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -641,8 +686,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_app_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_app_outage", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -656,56 +704,59 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "affectedDomains" : [ "periodic-failure.com", "periodic-failure.com" ], - "affectedTests" : [ { - "name" : "amazon-test2", - "id" : 5 + "affectedDomains" : [ "periodic-failure.com", "periodic-failure.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 }, { - "name" : "amazon-test2", - "id" : 5 + "name" : "amazon-test2", + "id" : 5 } ], - "endDate" : "2023-01-27T20:53:51.256Z", - "_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" + "endDate" : "2023-01-27T20:53:51.256Z", + "_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" } }, - "networkName" : "Rackspace Hosting", - "endRoundId" : 1674852600, - "providerType" : "IAAS", - "duration" : 180, - "startRoundId" : 1674852600, - "affectedAgents" : [ { - "name" : "London, England", - "id" : 11 + "networkName" : "Rackspace Hosting", + "endRoundId" : 1674852600, + "providerType" : "IAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 }, { - "name" : "London, England", - "id" : 11 + "name" : "London, England", + "id" : 11 } ], - "id" : "8EF2760862C705783A2F8BCBAAABB44F28DBC670DBA3B610", - "asn" : 19994, - "providerName" : "Rackspace", - "startDate" : "2023-01-27T20:50:51.256Z", - "affectedLocations" : [ { - "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], - "location" : "Chicago, Illinois, US" + "id" : "8EF2760862C705783A2F8BCBAAABB44F28DBC670DBA3B610", + "asn" : 19994, + "providerName" : "Rackspace", + "startDate" : "2023-01-27T20:50:51.256Z", + "affectedLocations" : [ { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" }, { - "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], - "location" : "Chicago, Illinois, US" + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -738,8 +789,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -760,8 +814,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -785,8 +842,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -810,8 +870,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -835,8 +898,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -860,8 +926,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -885,8 +954,11 @@ class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_network_outage( + outage_id=outage_id, + aid=aid, + _headers=self.te_headers("get_network_outage", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py b/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py index 1b6e9ce5..a8bf42de 100644 --- a/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py +++ b/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py @@ -46,77 +46,81 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "shareDate" : "2023-06-06T00:00:00Z", - "uid" : "281474976810911", - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "shareDate" : "2023-06-06T00:00:00Z", + "uid" : "281474976810911", + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" }, - "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" + "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" } }, - "startRoundId" : 1538784000, - "displayName" : "Snapshot created through API", - "endRoundId" : 1538787600, - "testId" : "281474976710801", - "extraParams" : "params", - "id" : "wdiac", - "roundId" : 1538784000, - "sourceTestId" : "281474976710706" + "startRoundId" : 1538784000, + "displayName" : "Snapshot created through API", + "endRoundId" : 1538787600, + "testId" : "281474976710801", + "extraParams" : "params", + "id" : "wdiac", + "roundId" : 1538784000, + "sourceTestId" : "281474976710706" } """ expected_response = json.loads(response_body_json) response = self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -160,9 +164,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -194,9 +202,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -231,9 +243,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -268,9 +284,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -305,9 +325,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -342,9 +366,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -379,9 +407,13 @@ class TestTestSnapshotsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_test_snapshot( + test_id=test_id, + snapshot_request=snapshot_request, + aid=aid, + _headers=self.te_headers("create_test_snapshot", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py index 55530ef0..d196589f 100644 --- a/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py +++ b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py @@ -96,82 +96,85 @@ class TestStreamingApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "endpointAgentLabel" : [ { - "id" : "1234" + "endpointAgentLabel" : [ { + "id" : "1234" }, { - "id" : "1234" + "id" : "1234" } ], - "endpointType" : "grpc", - "_links" : { - "self" : { - "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" } }, - "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", - "exporterConfig" : { - "authorization" : { - "oAuth2" : { - "clientId" : "1234567890", - "tokenUrl" : "https://example.com/token", - "clientSecret" : "1234567890", - "scopes" : [ "read", "write" ] + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] } }, - "splunkHec" : { - "sourceType" : "ThousandEyesOTel", - "index" : "thousandeyes_otel_events_index", - "source" : "ThousandEyesOTel", - "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" } }, - "filters" : { - "testTypes" : { - "values" : [ "agent-to-server", "bgp", "http-server" ] + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] } }, - "type" : "opentelemetry", - "enabled" : true, - "dataModelVersion" : "v2", - "endpointAgentTag" : [ { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" }, { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" } ], - "testMatch" : [ { - "id" : "1234", - "domain" : "cea" + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" }, { - "id" : "5678", - "domain" : "endpoint" + "id" : "5678", + "domain" : "endpoint" } ], - "tagMatch" : [ { - "key" : "keyA", - "value" : "valueA" + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" }, { - "key" : "keyB", - "value" : "valueB" + "key" : "keyB", + "value" : "valueB" } ], - "id" : "342ieu09", - "streamStatus" : { - "lastSuccess" : 1679677853573, - "lastFailure" : 1679677853573, - "status" : "connected" + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" }, - "signal" : "metric", - "auditOperation" : { - "createdDate" : 1679677853573, - "createdBy" : 3962 + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "createdBy" : 3962 }, - "customHeaders" : { - "Authorization" : "*****", - "Content-Type" : "*****" + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" } } """ expected_response = json.loads(response_body_json) response = self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -255,8 +258,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -338,8 +344,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -423,8 +432,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(412) ) as context: self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="412"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -508,8 +520,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_stream( + aid=aid, + stream=stream, + _headers=self.te_headers("create_stream", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -522,8 +537,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): id = 'id_example' aid = '1234' response = self.api.delete_stream_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_stream"), ) self.assertEqual(204, response.status_code) @@ -545,8 +563,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_stream( + id=id, + aid=aid, + _headers=self.te_headers("delete_stream", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -569,8 +590,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_stream( + id=id, + aid=aid, + _headers=self.te_headers("delete_stream", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -582,88 +606,89 @@ class TestStreamingApiIntegration(IntegrationTestBase): """Integration test for get_stream success path""" id = 'id_example' aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() response_body_json = """ { - "endpointAgentLabel" : [ { - "id" : "1234" + "endpointAgentLabel" : [ { + "id" : "1234" }, { - "id" : "1234" + "id" : "1234" } ], - "endpointType" : "grpc", - "_links" : { - "self" : { - "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" } }, - "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", - "exporterConfig" : { - "authorization" : { - "oAuth2" : { - "clientId" : "1234567890", - "tokenUrl" : "https://example.com/token", - "clientSecret" : "1234567890", - "scopes" : [ "read", "write" ] + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] } }, - "splunkHec" : { - "sourceType" : "ThousandEyesOTel", - "index" : "thousandeyes_otel_events_index", - "source" : "ThousandEyesOTel", - "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" } }, - "filters" : { - "testTypes" : { - "values" : [ "agent-to-server", "bgp", "http-server" ] + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] } }, - "type" : "opentelemetry", - "enabled" : true, - "dataModelVersion" : "v2", - "endpointAgentTag" : [ { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" }, { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" } ], - "testMatch" : [ { - "id" : "1234", - "domain" : "cea" + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" }, { - "id" : "5678", - "domain" : "endpoint" + "id" : "5678", + "domain" : "endpoint" } ], - "tagMatch" : [ { - "key" : "keyA", - "value" : "valueA" + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" }, { - "key" : "keyB", - "value" : "valueB" + "key" : "keyB", + "value" : "valueB" } ], - "id" : "342ieu09", - "streamStatus" : { - "lastSuccess" : 1679677853573, - "lastFailure" : 1679677853573, - "status" : "connected" + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" }, - "signal" : "metric", - "auditOperation" : { - "createdDate" : 1679677853573, - "updatedBy" : 3962, - "createdBy" : 3962, - "updatedDate" : 1679677853573 + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 }, - "customHeaders" : { - "Authorization" : "*****", - "Content-Type" : "*****" + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" } } """ expected_response = json.loads(response_body_json) response = self.api.get_stream( + id=id, + aid=aid, - type=type, + _headers=self.te_headers("get_stream"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -673,7 +698,6 @@ class TestStreamingApiIntegration(IntegrationTestBase): """Integration test for get_stream error path (HTTP 401)""" id = 'id_example' aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() error_body_json = """ { "error_description" : "Invalid access token", @@ -685,9 +709,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_stream( + id=id, + aid=aid, - type=type, + _headers=self.te_headers("get_stream", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -697,7 +723,6 @@ class TestStreamingApiIntegration(IntegrationTestBase): """Integration test for get_stream error path (HTTP 500)""" id = 'id_example' aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() error_body_json = """ { "path" : "https://api.thousandeyes.com/v7/request/path", @@ -711,9 +736,11 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_stream( + id=id, + aid=aid, - type=type, + _headers=self.te_headers("get_stream", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -724,160 +751,160 @@ class TestStreamingApiIntegration(IntegrationTestBase): def test_get_streams_happy_path(self) -> None: """Integration test for get_streams success path""" aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() response_body_json = """ [ { - "endpointAgentLabel" : [ { - "id" : "1234" + "endpointAgentLabel" : [ { + "id" : "1234" }, { - "id" : "1234" + "id" : "1234" } ], - "endpointType" : "grpc", - "_links" : { - "self" : { - "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" } }, - "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", - "exporterConfig" : { - "authorization" : { - "oAuth2" : { - "clientId" : "1234567890", - "tokenUrl" : "https://example.com/token", - "clientSecret" : "1234567890", - "scopes" : [ "read", "write" ] + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] } }, - "splunkHec" : { - "sourceType" : "ThousandEyesOTel", - "index" : "thousandeyes_otel_events_index", - "source" : "ThousandEyesOTel", - "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" } }, - "filters" : { - "testTypes" : { - "values" : [ "agent-to-server", "bgp", "http-server" ] + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] } }, - "type" : "opentelemetry", - "enabled" : true, - "dataModelVersion" : "v2", - "endpointAgentTag" : [ { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" }, { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" } ], - "testMatch" : [ { - "id" : "1234", - "domain" : "cea" + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" }, { - "id" : "5678", - "domain" : "endpoint" + "id" : "5678", + "domain" : "endpoint" } ], - "tagMatch" : [ { - "key" : "keyA", - "value" : "valueA" + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" }, { - "key" : "keyB", - "value" : "valueB" + "key" : "keyB", + "value" : "valueB" } ], - "id" : "342ieu09", - "streamStatus" : { - "lastSuccess" : 1679677853573, - "lastFailure" : 1679677853573, - "status" : "connected" + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" }, - "signal" : "metric", - "auditOperation" : { - "createdDate" : 1679677853573, - "updatedBy" : 3962, - "createdBy" : 3962, - "updatedDate" : 1679677853573 + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 }, - "customHeaders" : { - "Authorization" : "*****", - "Content-Type" : "*****" + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" } }, { - "endpointAgentLabel" : [ { - "id" : "1234" + "endpointAgentLabel" : [ { + "id" : "1234" }, { - "id" : "1234" + "id" : "1234" } ], - "endpointType" : "grpc", - "_links" : { - "self" : { - "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" } }, - "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", - "exporterConfig" : { - "authorization" : { - "oAuth2" : { - "clientId" : "1234567890", - "tokenUrl" : "https://example.com/token", - "clientSecret" : "1234567890", - "scopes" : [ "read", "write" ] + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] } }, - "splunkHec" : { - "sourceType" : "ThousandEyesOTel", - "index" : "thousandeyes_otel_events_index", - "source" : "ThousandEyesOTel", - "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" } }, - "filters" : { - "testTypes" : { - "values" : [ "agent-to-server", "bgp", "http-server" ] + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] } }, - "type" : "opentelemetry", - "enabled" : true, - "dataModelVersion" : "v2", - "endpointAgentTag" : [ { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" }, { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" } ], - "testMatch" : [ { - "id" : "1234", - "domain" : "cea" + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" }, { - "id" : "5678", - "domain" : "endpoint" + "id" : "5678", + "domain" : "endpoint" } ], - "tagMatch" : [ { - "key" : "keyA", - "value" : "valueA" + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" }, { - "key" : "keyB", - "value" : "valueB" + "key" : "keyB", + "value" : "valueB" } ], - "id" : "342ieu09", - "streamStatus" : { - "lastSuccess" : 1679677853573, - "lastFailure" : 1679677853573, - "status" : "connected" + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" }, - "signal" : "metric", - "auditOperation" : { - "createdDate" : 1679677853573, - "updatedBy" : 3962, - "createdBy" : 3962, - "updatedDate" : 1679677853573 + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 }, - "customHeaders" : { - "Authorization" : "*****", - "Content-Type" : "*****" + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" } } ] """ expected_response = json.loads(response_body_json) response = self.api.get_streams( + aid=aid, - type=type, + _headers=self.te_headers("get_streams"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -886,7 +913,6 @@ class TestStreamingApiIntegration(IntegrationTestBase): def test_get_streams_error_400(self) -> None: """Integration test for get_streams error path (HTTP 400)""" aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() error_body_json = """ { "path" : "https://api.thousandeyes.com/v7/streams", @@ -900,8 +926,9 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_streams( + aid=aid, - type=type, + _headers=self.te_headers("get_streams", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -910,7 +937,6 @@ class TestStreamingApiIntegration(IntegrationTestBase): def test_get_streams_error_401(self) -> None: """Integration test for get_streams error path (HTTP 401)""" aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() error_body_json = """ { "error_description" : "Invalid access token", @@ -922,8 +948,9 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_streams( + aid=aid, - type=type, + _headers=self.te_headers("get_streams", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -932,7 +959,6 @@ class TestStreamingApiIntegration(IntegrationTestBase): def test_get_streams_error_500(self) -> None: """Integration test for get_streams error path (HTTP 500)""" aid = '1234' - type = thousandeyes_sdk.streaming.StreamType() error_body_json = """ { "path" : "https://api.thousandeyes.com/v7/request/path", @@ -946,8 +972,9 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_streams( + aid=aid, - type=type, + _headers=self.te_headers("get_streams", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1019,85 +1046,89 @@ class TestStreamingApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "endpointAgentLabel" : [ { - "id" : "1234" + "endpointAgentLabel" : [ { + "id" : "1234" }, { - "id" : "1234" + "id" : "1234" } ], - "endpointType" : "grpc", - "_links" : { - "self" : { - "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" } }, - "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", - "exporterConfig" : { - "authorization" : { - "oAuth2" : { - "clientId" : "1234567890", - "tokenUrl" : "https://example.com/token", - "clientSecret" : "1234567890", - "scopes" : [ "read", "write" ] + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] } }, - "splunkHec" : { - "sourceType" : "ThousandEyesOTel", - "index" : "thousandeyes_otel_events_index", - "source" : "ThousandEyesOTel", - "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" } }, - "filters" : { - "testTypes" : { - "values" : [ "agent-to-server", "bgp", "http-server" ] + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] } }, - "type" : "opentelemetry", - "enabled" : true, - "dataModelVersion" : "v2", - "endpointAgentTag" : [ { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" }, { - "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" } ], - "testMatch" : [ { - "id" : "1234", - "domain" : "cea" + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" }, { - "id" : "5678", - "domain" : "endpoint" + "id" : "5678", + "domain" : "endpoint" } ], - "tagMatch" : [ { - "key" : "keyA", - "value" : "valueA" + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" }, { - "key" : "keyB", - "value" : "valueB" + "key" : "keyB", + "value" : "valueB" } ], - "id" : "342ieu09", - "streamStatus" : { - "lastSuccess" : 1679677853573, - "lastFailure" : 1679677853573, - "status" : "connected" + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" }, - "signal" : "metric", - "auditOperation" : { - "createdDate" : 1679677853573, - "updatedBy" : 3962, - "createdBy" : 3962, - "updatedDate" : 1679677853573 + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 }, - "customHeaders" : { - "Authorization" : "*****", - "Content-Type" : "*****" + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" } } """ expected_response = json.loads(response_body_json) response = self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1178,9 +1209,13 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1259,9 +1294,13 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1342,9 +1381,13 @@ class TestStreamingApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_stream( + id=id, + aid=aid, + put_stream=put_stream, + _headers=self.te_headers("update_stream", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py b/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py index e01ffbb6..692a2599 100644 --- a/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py +++ b/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py @@ -49,33 +49,37 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", - "_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" + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -110,9 +114,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -150,9 +158,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -190,9 +202,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -230,9 +246,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -269,9 +289,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.assign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("assign_tag", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -346,58 +370,58 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "tags" : [ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", - "_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" + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" } } }, { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", - "_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" + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" } } } ] @@ -405,8 +429,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): """ expected_response = json.loads(response_body_json) response = self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -488,8 +515,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -574,8 +604,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -660,8 +693,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -746,8 +782,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -831,8 +870,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.assign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("assign_tags", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -859,9 +901,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' response = self.api.unassign_tag_with_http_info( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag"), ) self.assertEqual(204, response.status_code) @@ -897,9 +943,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -937,9 +987,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -977,9 +1031,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1017,9 +1075,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1056,9 +1118,13 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.unassign_tag( + id=id, + tag_assignment=tag_assignment, + aid=aid, + _headers=self.te_headers("unassign_tag", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1133,58 +1199,58 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "tags" : [ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", - "_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" + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" } } }, { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", - "_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" + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_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" } } } ] @@ -1192,8 +1258,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): """ expected_response = json.loads(response_body_json) response = self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1275,8 +1344,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1361,8 +1433,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1447,8 +1522,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1533,8 +1611,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1618,8 +1699,11 @@ class TestTagAssignmentApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.unassign_tags( + bulk_tag_assignments=bulk_tag_assignments, + aid=aid, + _headers=self.te_headers("unassign_tags", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tags/test/test_tags_api_integration.py b/thousandeyes-sdk-tags/test/test_tags_api_integration.py index 39cbe039..c2652462 100644 --- a/thousandeyes-sdk-tags/test/test_tags_api_integration.py +++ b/thousandeyes-sdk-tags/test/test_tags_api_integration.py @@ -74,57 +74,60 @@ class TestTagsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } """ expected_response = json.loads(response_body_json) response = self.api.create_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -196,8 +199,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -257,8 +263,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -320,8 +329,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_tag( + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("create_tag", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -527,198 +539,201 @@ class TestTagsApiIntegration(IntegrationTestBase): 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" + "_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" } }, - "errors" : [ { - "tag" : { - "key" : { - "assignments" : [ { - "id" : "123", - "type" : "test" + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "matchType" : "and", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } }, - "message" : "Object successfully created", - "responseCode" : 200 + "message" : "Object successfully created", + "responseCode" : 200 }, { - "tag" : { - "key" : { - "assignments" : [ { - "id" : "123", - "type" : "test" + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "matchType" : "and", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } }, - "message" : "Object successfully created", - "responseCode" : 200 + "message" : "Object successfully created", + "responseCode" : 200 } ], - "tags" : [ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" }, { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -943,8 +958,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1157,8 +1175,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1373,8 +1394,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_tags( + aid=aid, + bulk_tag_response=bulk_tag_response, + _headers=self.te_headers("create_tags", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1387,8 +1411,11 @@ class TestTagsApiIntegration(IntegrationTestBase): id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' response = self.api.delete_tag_with_http_info( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag"), ) self.assertEqual(204, response.status_code) @@ -1410,8 +1437,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1435,8 +1465,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1460,8 +1493,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1485,8 +1521,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1509,8 +1548,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_tag( + id=id, + aid=aid, + _headers=self.te_headers("delete_tag", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1522,61 +1564,62 @@ class TestTagsApiIntegration(IntegrationTestBase): """Integration test for get_tag success path""" id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] response_body_json = """ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_tag( + id=id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_tag"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1586,7 +1629,6 @@ class TestTagsApiIntegration(IntegrationTestBase): """Integration test for get_tag error path (HTTP 401)""" id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1598,9 +1640,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_tag( + id=id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_tag", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1610,7 +1654,6 @@ class TestTagsApiIntegration(IntegrationTestBase): """Integration test for get_tag error path (HTTP 403)""" id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "instance" : "instance", @@ -1625,9 +1668,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_tag( + id=id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_tag", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1637,7 +1682,6 @@ class TestTagsApiIntegration(IntegrationTestBase): """Integration test for get_tag error path (HTTP 404)""" id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "instance" : "instance", @@ -1652,9 +1696,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_tag( + id=id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_tag", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1664,7 +1710,6 @@ class TestTagsApiIntegration(IntegrationTestBase): """Integration test for get_tag error path (HTTP 429)""" id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "instance" : "instance", @@ -1679,9 +1724,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_tag( + id=id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_tag", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1691,7 +1738,6 @@ class TestTagsApiIntegration(IntegrationTestBase): """Integration test for get_tag error path (HTTP 500)""" id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "path" : "https://api.thousandeyes.com/v7/request/path", @@ -1705,9 +1751,11 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_tag( + id=id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_tag", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1718,120 +1766,120 @@ class TestTagsApiIntegration(IntegrationTestBase): def test_get_tags_happy_path(self) -> None: """Integration test for get_tags success path""" aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] 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" + "_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" } }, - "tags" : [ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" }, { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_tags( + aid=aid, - expand=expand, + _headers=self.te_headers("get_tags"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1840,7 +1888,6 @@ class TestTagsApiIntegration(IntegrationTestBase): def test_get_tags_error_401(self) -> None: """Integration test for get_tags error path (HTTP 401)""" aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1852,8 +1899,9 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_tags( + aid=aid, - expand=expand, + _headers=self.te_headers("get_tags", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1862,7 +1910,6 @@ class TestTagsApiIntegration(IntegrationTestBase): def test_get_tags_error_403(self) -> None: """Integration test for get_tags error path (HTTP 403)""" aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "instance" : "instance", @@ -1877,8 +1924,9 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_tags( + aid=aid, - expand=expand, + _headers=self.te_headers("get_tags", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1887,7 +1935,6 @@ class TestTagsApiIntegration(IntegrationTestBase): def test_get_tags_error_404(self) -> None: """Integration test for get_tags error path (HTTP 404)""" aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "instance" : "instance", @@ -1902,8 +1949,9 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_tags( + aid=aid, - expand=expand, + _headers=self.te_headers("get_tags", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1912,7 +1960,6 @@ class TestTagsApiIntegration(IntegrationTestBase): def test_get_tags_error_429(self) -> None: """Integration test for get_tags error path (HTTP 429)""" aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "instance" : "instance", @@ -1927,8 +1974,9 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_tags( + aid=aid, - expand=expand, + _headers=self.te_headers("get_tags", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1937,7 +1985,6 @@ class TestTagsApiIntegration(IntegrationTestBase): def test_get_tags_error_500(self) -> None: """Integration test for get_tags error path (HTTP 500)""" aid = '1234' - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] error_body_json = """ { "path" : "https://api.thousandeyes.com/v7/request/path", @@ -1951,8 +1998,9 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_tags( + aid=aid, - expand=expand, + _headers=self.te_headers("get_tags", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2006,58 +2054,62 @@ class TestTagsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "assignments" : [ { - "id" : "123", - "type" : "test" + "assignments" : [ { + "id" : "123", + "type" : "test" }, { - "id" : "123", - "type" : "test" + "id" : "123", + "type" : "test" } ], - "color" : "#FF0000", - "_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" + "color" : "#FF0000", + "_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", - "builtIn" : true, - "icon" : "icon", - "description" : "To tag assets in San Francisco", - "filters" : [ { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" }, { - "mode" : "in", - "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], - "scope" : "custom", - "key" : "vpn-client-network" + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" } ], - "type" : "static", - "objectType" : "test", - "accessType" : "all", - "modifiedDate" : "2022-03-01T23:31:11Z", - "legacyId" : 0.8008281904610115, - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "aid" : 1234, - "value" : "sfo", - "key" : "branch", - "createDate" : "2022-03-01T23:31:11Z" + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" } """ expected_response = json.loads(response_body_json) response = self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2118,9 +2170,13 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2184,9 +2240,13 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2250,9 +2310,13 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2316,9 +2380,13 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2381,9 +2449,13 @@ class TestTagsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_tag( + id=id, + aid=aid, + tag_info=tag_info, + _headers=self.te_headers("update_tag", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py index 980d4167..d9d14a54 100644 --- a/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py @@ -37,231 +37,236 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "completion" : 100, - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "errorType" : "None", - "apiTransactionTime" : 990.1, - "startTime" : 1384309800, - "endTime" : 1384309800, - "requests" : [ { - "completion" : 100, - "stepType" : "default", - "responseTime" : 440.8, - "apiCallTime" : 900.9, - "processingTime" : 59.9, - "url" : "https://api.thousandeyes.com/v7/status", - "sendTime" : 8.1, - "receiveTime" : 224.1, - "connectTime" : 12.1, - "dnsTime" : 11.1, - "name" : "First Step to Acquire Token", - "stepNumber" : 1, - "assertions" : [ { - "hasFailed" : false, - "step" : 1 + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 }, { - "hasFailed" : false, - "step" : 1 + "hasFailed" : false, + "step" : 1 } ], - "assertErrorCount" : 0, - "blockedTime" : 49.9, - "stepTime" : 990.1, - "waitTime" : 18.1 + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 }, { - "completion" : 100, - "stepType" : "default", - "responseTime" : 440.8, - "apiCallTime" : 900.9, - "processingTime" : 59.9, - "url" : "https://api.thousandeyes.com/v7/status", - "sendTime" : 8.1, - "receiveTime" : 224.1, - "connectTime" : 12.1, - "dnsTime" : 11.1, - "name" : "First Step to Acquire Token", - "stepNumber" : 1, - "assertions" : [ { - "hasFailed" : false, - "step" : 1 + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 }, { - "hasFailed" : false, - "step" : 1 + "hasFailed" : false, + "step" : 1 } ], - "assertErrorCount" : 0, - "blockedTime" : 49.9, - "stepTime" : 990.1, - "waitTime" : 18.1 + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 } ], - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "completion" : 100, - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "errorType" : "None", - "apiTransactionTime" : 990.1, - "startTime" : 1384309800, - "endTime" : 1384309800, - "requests" : [ { - "completion" : 100, - "stepType" : "default", - "responseTime" : 440.8, - "apiCallTime" : 900.9, - "processingTime" : 59.9, - "url" : "https://api.thousandeyes.com/v7/status", - "sendTime" : 8.1, - "receiveTime" : 224.1, - "connectTime" : 12.1, - "dnsTime" : 11.1, - "name" : "First Step to Acquire Token", - "stepNumber" : 1, - "assertions" : [ { - "hasFailed" : false, - "step" : 1 + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 }, { - "hasFailed" : false, - "step" : 1 + "hasFailed" : false, + "step" : 1 } ], - "assertErrorCount" : 0, - "blockedTime" : 49.9, - "stepTime" : 990.1, - "waitTime" : 18.1 + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 }, { - "completion" : 100, - "stepType" : "default", - "responseTime" : 440.8, - "apiCallTime" : 900.9, - "processingTime" : 59.9, - "url" : "https://api.thousandeyes.com/v7/status", - "sendTime" : 8.1, - "receiveTime" : 224.1, - "connectTime" : 12.1, - "dnsTime" : 11.1, - "name" : "First Step to Acquire Token", - "stepNumber" : 1, - "assertions" : [ { - "hasFailed" : false, - "step" : 1 + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 }, { - "hasFailed" : false, - "step" : 1 + "hasFailed" : false, + "step" : 1 } ], - "assertErrorCount" : 0, - "blockedTime" : 49.9, - "stepTime" : 990.1, - "waitTime" : 18.1 + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 } ], - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -296,10 +301,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -322,10 +332,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -351,10 +366,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -380,10 +400,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -409,10 +434,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -438,10 +468,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -467,10 +502,15 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_api_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_api_agent_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -488,137 +528,144 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "completion" : 100, - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "errorType" : "None", - "apiTransactionTime" : 990.1, - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "completion" : 100, - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "errorType" : "None", - "apiTransactionTime" : 990.1, - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -655,12 +702,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -685,12 +739,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -718,12 +779,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -751,12 +819,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -784,12 +859,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -817,12 +899,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -850,12 +939,19 @@ class TestAPITestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_api_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_api_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py index 09c183f8..d813920f 100644 --- a/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py @@ -40,140 +40,148 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "server" : "a1.verisigndns.com.", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "mappings" : "208.185.7.120", - "_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" + "mappings" : "208.185.7.120", + "_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" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "resolutionTime" : 3, - "roundId" : 1384309800, - "serverId" : "456", - "errorDetails" : "Connection error" + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "server" : "a1.verisigndns.com.", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "mappings" : "208.185.7.120", - "_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" + "mappings" : "208.185.7.120", + "_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" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "resolutionTime" : 3, - "roundId" : 1384309800, - "serverId" : "456", - "errorDetails" : "Connection error" + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -211,13 +219,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -243,13 +259,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -278,13 +302,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -313,13 +345,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -348,13 +388,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -383,13 +431,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -418,13 +474,21 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_dns_server_result( + test_id=test_id, + server_id=server_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_server_result", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -442,139 +506,146 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "server" : "a1.verisigndns.com.", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "mappings" : "208.185.7.120", - "_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" + "mappings" : "208.185.7.120", + "_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" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "resolutionTime" : 3, - "roundId" : 1384309800, - "serverId" : "456", - "errorDetails" : "Connection error" + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "server" : "a1.verisigndns.com.", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "mappings" : "208.185.7.120", - "_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" + "mappings" : "208.185.7.120", + "_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" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "resolutionTime" : 3, - "roundId" : 1384309800, - "serverId" : "456", - "errorDetails" : "Connection error" + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -611,12 +682,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -641,12 +719,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -674,12 +759,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -707,12 +799,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -740,12 +839,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -773,12 +879,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -806,12 +919,19 @@ class TestDNSServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_dns_servers_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_servers_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py index 5301c030..70345c51 100644 --- a/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py @@ -39,143 +39,150 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "finalServerQueried" : "a1.verisigndns.com.", - "finalQueryTime" : 178, - "queries" : 3, - "failedQueries" : 0, - "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", - "mappings" : "208.185.7.120", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "finalServerQueried" : "a1.verisigndns.com.", - "finalQueryTime" : 178, - "queries" : 3, - "failedQueries" : 0, - "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", - "mappings" : "208.185.7.120", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -212,12 +219,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -242,12 +256,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -275,12 +296,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -308,12 +336,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -341,12 +376,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -374,12 +416,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -407,12 +456,19 @@ class TestDNSTraceTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_dns_trace_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_trace_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py index 34183ffb..18e9c670 100644 --- a/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py @@ -39,133 +39,140 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "isValid" : true, - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "isValid" : true, - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -202,12 +209,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -232,12 +246,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -265,12 +286,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -298,12 +326,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -331,12 +366,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -364,12 +406,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -397,12 +446,19 @@ class TestDNSSECTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_dns_sec_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_dns_sec_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py index 070314ed..562ab1b2 100644 --- a/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py @@ -39,137 +39,144 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22: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" + "results" : [ { + "date" : "2022-07-17T22: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" } }, - "prefix" : "99.128.0.0/11", - "monitor" : { - "monitorId" : "281474976710706", - "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", - "countryId" : "US" + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "reachability" : 0, - "updates" : 0, - "pathChanges" : 0, - "roundId" : 1384309800, - "prefixId" : "215" + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" }, { - "date" : "2022-07-17T22: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" + "date" : "2022-07-17T22: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" } }, - "prefix" : "99.128.0.0/11", - "monitor" : { - "monitorId" : "281474976710706", - "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", - "countryId" : "US" + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "reachability" : 0, - "updates" : 0, - "pathChanges" : 0, - "roundId" : 1384309800, - "prefixId" : "215" + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -206,12 +213,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -236,12 +250,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -269,12 +290,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -302,12 +330,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -335,12 +370,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -368,12 +410,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -401,12 +450,19 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_bgp_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_bgp_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -422,119 +478,124 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" } }, - "results" : [ { - "date" : "2022-07-17T22: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" + "results" : [ { + "date" : "2022-07-17T22: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" } }, - "prefix" : "99.128.0.0/11", - "monitor" : { - "monitorId" : "281474976710706", - "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", - "countryId" : "US" + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" }, - "hops" : [ { - "asName" : "Telus Advanced Communications", - "asn" : 852 + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 }, { - "asName" : "Telus Advanced Communications", - "asn" : 852 + "asName" : "Telus Advanced Communications", + "asn" : 852 } ], - "isActive" : true, - "roundId" : 1384309800, - "prefixId" : "215" + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" }, { - "date" : "2022-07-17T22: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" + "date" : "2022-07-17T22: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" } }, - "prefix" : "99.128.0.0/11", - "monitor" : { - "monitorId" : "281474976710706", - "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", - "countryId" : "US" + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" }, - "hops" : [ { - "asName" : "Telus Advanced Communications", - "asn" : 852 + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 }, { - "asName" : "Telus Advanced Communications", - "asn" : 852 + "asName" : "Telus Advanced Communications", + "asn" : 852 } ], - "isActive" : true, - "roundId" : 1384309800, - "prefixId" : "215" + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -569,10 +630,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -595,10 +661,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -624,10 +695,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -653,10 +729,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -682,10 +763,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -711,10 +797,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -740,10 +831,15 @@ class TestNetworkBGPTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_bgp_routes_prefix_round_results( + test_id=test_id, + prefix_id=prefix_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_bgp_routes_prefix_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py index 7134c5d1..d0cc370b 100644 --- a/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py @@ -37,169 +37,174 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "server" : "www.thousandeyes.com:80", - "availableBandwidth" : 9.100464, - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], - "avgLatency" : 167.04, - "bandwidth" : 4.3313155, - "minLatency" : 167, - "_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" + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_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" } }, - "maxLatency" : 168, - "proxyJitter" : 1.2, - "proxyAverageLatency" : 45, - "proxyLoss" : 2.5, - "healthScore" : 0.98, - "capacity" : 210.10854, - "loss" : 0, - "proxyMinLatency" : 40, - "jitter" : 0.076808, - "serverIp" : "50.18.127.223", - "startTime" : 1384309800, - "endTime" : 1384309800, - "proxyMaxLatency" : 50, - "roundId" : 1384309800, - "direction" : "to-target" + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" }, { - "date" : "2022-07-17T22:00:54Z", - "server" : "www.thousandeyes.com:80", - "availableBandwidth" : 9.100464, - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], - "avgLatency" : 167.04, - "bandwidth" : 4.3313155, - "minLatency" : 167, - "_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" + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_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" } }, - "maxLatency" : 168, - "proxyJitter" : 1.2, - "proxyAverageLatency" : 45, - "proxyLoss" : 2.5, - "healthScore" : 0.98, - "capacity" : 210.10854, - "loss" : 0, - "proxyMinLatency" : 40, - "jitter" : 0.076808, - "serverIp" : "50.18.127.223", - "startTime" : 1384309800, - "endTime" : 1384309800, - "proxyMaxLatency" : 50, - "roundId" : 1384309800, - "direction" : "to-target" + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -213,7 +218,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "instance" : "instance", @@ -237,13 +241,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -257,7 +267,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "error_description" : "Invalid access token", @@ -269,13 +278,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -289,7 +304,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "instance" : "instance", @@ -304,13 +318,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -324,7 +344,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "instance" : "instance", @@ -339,13 +358,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -359,7 +384,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "instance" : "instance", @@ -374,13 +398,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -394,7 +424,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "instance" : "instance", @@ -409,13 +438,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -429,7 +464,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.TestDirection() error_body_json = """ { "instance" : "instance", @@ -444,13 +478,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_network_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_network_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -464,207 +504,210 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "server" : "www.google.com:443", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "targetIsProxy" : true, - "sourcePrefix" : "196.40.96.0/20", - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803" + "pathId" : "4711301366345855606023718047703941305741293841502186803" }, { - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803" + "pathId" : "4711301366345855606023718047703941305741293841502186803" } ], - "serverIp" : "172.217.170.68", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "direction" : "to-target" + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" }, { - "date" : "2022-07-17T22:00:54Z", - "server" : "www.google.com:443", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "targetIsProxy" : true, - "sourcePrefix" : "196.40.96.0/20", - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803" + "pathId" : "4711301366345855606023718047703941305741293841502186803" }, { - "hops" : [ { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" }, { - "rdns" : "core-router1.cpt2.host-h.net", - "prefix" : "196.40.96.0/20", - "responseTime" : 1, - "hop" : 1, - "ipAddress" : "196.40.106.237", - "mpls" : "mpls", - "location" : "Cape Town, South Africa", - "network" : "HETZNER (Pty) Ltd (AS 37153)" + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" } ], - "pathId" : "4711301366345855606023718047703941305741293841502186803" + "pathId" : "4711301366345855606023718047703941305741293841502186803" } ], - "serverIp" : "172.217.170.68", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "direction" : "to-target" + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -676,7 +719,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -700,11 +742,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -716,7 +762,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "error_description" : "Invalid access token", @@ -728,11 +773,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -744,7 +793,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -759,11 +807,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -775,7 +827,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -790,11 +841,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -806,7 +861,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -821,11 +875,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -837,7 +895,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -852,11 +909,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -868,7 +929,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): agent_id = '11' round_id = '1384309800' aid = '1234' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -883,11 +943,15 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_path_vis_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, - direction=direction, + _headers=self.te_headers("get_test_path_vis_agent_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -903,175 +967,180 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "server" : "www.google.com:443", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "targetIsProxy" : true, - "sourcePrefix" : "196.40.96.0/20", - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "pathMtu" : 1500, - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "mss" : 1460 + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 }, { - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "pathMtu" : 1500, - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "mss" : 1460 + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 } ], - "serverIp" : "172.217.170.68", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "direction" : "to-target" + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" }, { - "date" : "2022-07-17T22:00:54Z", - "server" : "www.google.com:443", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "targetIsProxy" : true, - "sourcePrefix" : "196.40.96.0/20", - "sourceIp" : "196.40.106.237", - "pathTraces" : [ { - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "pathMtu" : 1500, - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "mss" : 1460 + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 }, { - "numberOfHops" : 15, - "responseTime" : 1500, - "ipAddress" : "196.40.106.237", - "pathMtu" : 1500, - "pathId" : "1230899668701775614109128428722974545787322404682781961521", - "mss" : 1460 + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 } ], - "serverIp" : "172.217.170.68", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "direction" : "to-target" + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1085,7 +1154,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -1109,13 +1177,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1129,7 +1203,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "error_description" : "Invalid access token", @@ -1141,13 +1214,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1161,7 +1240,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -1176,13 +1254,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1196,7 +1280,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -1211,13 +1294,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1231,7 +1320,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -1246,13 +1334,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1266,7 +1360,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -1281,13 +1374,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1301,7 +1400,6 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - direction = thousandeyes_sdk.test_results.PathVisDirection() error_body_json = """ { "instance" : "instance", @@ -1316,13 +1414,19 @@ class TestNetworkTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_path_vis_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - direction=direction, + _headers=self.te_headers("get_test_path_vis_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py index 29f3c0a4..7614c5e1 100644 --- a/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py @@ -39,151 +39,158 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "pdv" : 1, - "_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" + "pdv" : 1, + "_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" } }, - "dscpName" : "EF (DSCP 46)", - "latency" : 103, - "mos" : 4.351024, - "loss" : 0, - "dscp" : "46", - "codecMaxMos" : 4.41, - "discards" : 0, - "serverIp" : "172.97.102.37", - "errorDetail" : "Connection error", - "startTime" : 1384309800, - "endTime" : 1384309800, - "codecName" : "G.711 @ 64 Kbps", - "roundId" : 1384309800 + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "pdv" : 1, - "_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" + "pdv" : 1, + "_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" } }, - "dscpName" : "EF (DSCP 46)", - "latency" : 103, - "mos" : 4.351024, - "loss" : 0, - "dscp" : "46", - "codecMaxMos" : 4.41, - "discards" : 0, - "serverIp" : "172.97.102.37", - "errorDetail" : "Connection error", - "startTime" : 1384309800, - "endTime" : 1384309800, - "codecName" : "G.711 @ 64 Kbps", - "roundId" : 1384309800 + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -220,12 +227,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -250,12 +264,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -283,12 +304,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -316,12 +344,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -349,12 +384,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -382,12 +424,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -415,12 +464,19 @@ class TestVoiceRTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_rtp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_rtp_server_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py index fffe6ecd..73ccce68 100644 --- a/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py @@ -39,161 +39,168 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "numRedirects" : 0, - "registerTime" : 21, - "optionsTime" : 17, - "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nAuthorization: Digest username=\"al6054\", realm=\"asterisk\", nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\", uri=\"sip:6054@voice.sfo2.notarealco.com\", response=\"83c538a39ff766cf75ffd1d62317b442\", algorithm=MD5, cnonce=\"0a4f113b\", opaque=\"748ffa241d840721\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", - "responseTime" : 12, - "totalTime" : 40, - "errorType" : "none", - "availability" : 100, - "responseCode" : 200, - "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\"asterisk\",nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\",opaque=\"748ffa241d840721\",algorithm=md5,qop=\"auth\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", - "problemDetail" : "problemDetail", - "connectTime" : 5, - "dnsTime" : 2, - "serverIp" : "193.2.1.88", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "waitTime" : 5, - "inviteTime" : 10 + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: \\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: \\r\\nAuthorization: Digest username=\\"al6054\\", realm=\\"asterisk\\", nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\", uri=\\"sip:6054@voice.sfo2.notarealco.com\\", response=\\"83c538a39ff766cf75ffd1d62317b442\\", algorithm=MD5, cnonce=\\"0a4f113b\\", opaque=\\"748ffa241d840721\\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\\"asterisk\\",nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\",opaque=\\"748ffa241d840721\\",algorithm=md5,qop=\\"auth\\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "numRedirects" : 0, - "registerTime" : 21, - "optionsTime" : 17, - "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: <sip:6054@38.140.61.68:55431;transport=tcp>\\r\\nAuthorization: Digest username=\"al6054\", realm=\"asterisk\", nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\", uri=\"sip:6054@voice.sfo2.notarealco.com\", response=\"83c538a39ff766cf75ffd1d62317b442\", algorithm=MD5, cnonce=\"0a4f113b\", opaque=\"748ffa241d840721\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", - "responseTime" : 12, - "totalTime" : 40, - "errorType" : "none", - "availability" : 100, - "responseCode" : 200, - "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\"asterisk\",nonce=\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\",opaque=\"748ffa241d840721\",algorithm=md5,qop=\"auth\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: <sip:6054@voice.sfo2.notarealco.com>;tag=cGaJDNKQFE\\r\\nTo: <sip:6054@voice.sfo2.notarealco.com>;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", - "problemDetail" : "problemDetail", - "connectTime" : 5, - "dnsTime" : 2, - "serverIp" : "193.2.1.88", - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800, - "waitTime" : 5, - "inviteTime" : 10 + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: \\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: \\r\\nAuthorization: Digest username=\\"al6054\\", realm=\\"asterisk\\", nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\", uri=\\"sip:6054@voice.sfo2.notarealco.com\\", response=\\"83c538a39ff766cf75ffd1d62317b442\\", algorithm=MD5, cnonce=\\"0a4f113b\\", opaque=\\"748ffa241d840721\\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\\"asterisk\\",nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\",opaque=\\"748ffa241d840721\\",algorithm=md5,qop=\\"auth\\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -230,12 +237,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -260,12 +274,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -293,12 +314,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -326,12 +354,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -359,12 +394,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -392,12 +434,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -425,12 +474,19 @@ class TestVoiceSIPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_sip_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_sip_server_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py index 2a744c34..a4e01896 100644 --- a/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py @@ -39,155 +39,162 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "transferTime" : 99.865, - "_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" + "transferTime" : 99.865, + "_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" } }, - "negotiationTime" : 503.413, - "responseTime" : 0.589, - "totalTime" : 705.554, - "errorType" : "None", - "responseCode" : 226, - "dnsTime" : 0.589, - "connectTime" : 50.153, - "serverIp" : "193.2.1.88", - "startTime" : 1384309800, - "endTime" : 1384309800, - "throughput" : 123, - "roundId" : 1384309800, - "waitTime" : 52.1, - "wireSize" : 22172, - "errorDetails" : "Connection error" + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "transferTime" : 99.865, - "_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" + "transferTime" : 99.865, + "_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" } }, - "negotiationTime" : 503.413, - "responseTime" : 0.589, - "totalTime" : 705.554, - "errorType" : "None", - "responseCode" : 226, - "dnsTime" : 0.589, - "connectTime" : 50.153, - "serverIp" : "193.2.1.88", - "startTime" : 1384309800, - "endTime" : 1384309800, - "throughput" : 123, - "roundId" : 1384309800, - "waitTime" : 52.1, - "wireSize" : 22172, - "errorDetails" : "Connection error" + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -224,12 +231,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -254,12 +268,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -287,12 +308,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -320,12 +348,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -353,12 +388,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -386,12 +428,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -419,12 +468,19 @@ class TestWebFTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_ftp_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_ftp_server_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py index bf5d5e01..7a846289 100644 --- a/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py @@ -37,341 +37,346 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "sslVersion" : "TLSv1.3", - "_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" + "sslVersion" : "TLSv1.3", + "_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" } }, - "numRedirects" : 0, - "errorType" : "None", - "healthScore" : 0.98, - "responseCode" : 200, - "connectTime" : 2, - "startTime" : 1384309800, - "throughput" : 123, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "sslCipher" : "sslCipher", - "redirectTime" : 10, - "sslCertificates" : [ { - "hasValidSigningCert" : false, - "issuerName" : "DigiCert SHA2 Extended Validation Server CA", - "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], - "isFetchDateInValidCertDateRange" : true, - "validBefore" : "2020-05-12T12:00:00Z", - "daysUntilExpiry" : 0, - "validAfter" : "2018-03-27T00:00:00Z", - "subjectName" : "www.thousandeyes.com" + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" }, { - "hasValidSigningCert" : false, - "issuerName" : "DigiCert SHA2 Extended Validation Server CA", - "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], - "isFetchDateInValidCertDateRange" : true, - "validBefore" : "2020-05-12T12:00:00Z", - "daysUntilExpiry" : 0, - "validAfter" : "2018-03-27T00:00:00Z", - "subjectName" : "www.thousandeyes.com" + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" } ], - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "sslTime" : 9, - "endTime" : 1384309800, - "waitTime" : 3, - "dnsServerMeasurement" : { - "usedDnsResponse" : { - "id" : 41837, - "qr" : "response", - "opcode" : "query", - "authoritativeAnswer" : false, - "truncation" : false, - "recursionDesired" : true, - "recursionAvailable" : true, - "zero" : false, - "authenticData" : false, - "checkingDisabled" : false, - "responseCode" : "noerror", - "question" : [ { - "name" : "www.example.com", - "type" : "a", - "class" : "in", - "ttl" : 0, - "data" : "" + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" } ], - "answer" : [ { - "name" : "www.example.com", - "type" : "a", - "class" : "in", - "ttl" : 300, - "data" : "203.0.113.10" + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" } ], - "dnsResolver" : "8.8.8.8", - "timing" : { - "startTimeUs" : "1769706600000000", - "totalTimeUs" : 19304 + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 }, - "protocol" : "udp" + "protocol" : "udp" }, - "unusedDnsResponses" : [ { - "id" : 41838, - "qr" : "response", - "opcode" : "query", - "authoritativeAnswer" : false, - "truncation" : false, - "recursionDesired" : true, - "recursionAvailable" : true, - "zero" : false, - "authenticData" : false, - "checkingDisabled" : false, - "responseCode" : "nxdomain", - "question" : [ { - "name" : "www.example.com", - "type" : "aaaa", - "class" : "in", - "ttl" : 0, - "data" : "" + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" } ], - "dnsResolver" : "8.8.4.4", - "timing" : { - "startTimeUs" : "1769706600020000", - "totalTimeUs" : 15420 + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 }, - "protocol" : "udp" + "protocol" : "udp" } ], - "usedHostsFile" : false, - "resolvedIp" : "203.0.113.10" + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" }, - "wireSize" : 9993, - "errorDetails" : "Connection error" + "wireSize" : 9993, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "sslVersion" : "TLSv1.3", - "_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" + "sslVersion" : "TLSv1.3", + "_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" } }, - "numRedirects" : 0, - "errorType" : "None", - "healthScore" : 0.98, - "responseCode" : 200, - "connectTime" : 2, - "startTime" : 1384309800, - "throughput" : 123, - "roundId" : 1384309800, - "headers" : { - "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", - "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" }, - "sslCipher" : "sslCipher", - "redirectTime" : 10, - "sslCertificates" : [ { - "hasValidSigningCert" : false, - "issuerName" : "DigiCert SHA2 Extended Validation Server CA", - "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], - "isFetchDateInValidCertDateRange" : true, - "validBefore" : "2020-05-12T12:00:00Z", - "daysUntilExpiry" : 0, - "validAfter" : "2018-03-27T00:00:00Z", - "subjectName" : "www.thousandeyes.com" + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" }, { - "hasValidSigningCert" : false, - "issuerName" : "DigiCert SHA2 Extended Validation Server CA", - "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], - "isFetchDateInValidCertDateRange" : true, - "validBefore" : "2020-05-12T12:00:00Z", - "daysUntilExpiry" : 0, - "validAfter" : "2018-03-27T00:00:00Z", - "subjectName" : "www.thousandeyes.com" + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" } ], - "responseTime" : 14, - "totalTime" : 15, - "receiveTime" : 1, - "dnsTime" : 0, - "serverIp" : "193.2.1.88", - "sslTime" : 9, - "endTime" : 1384309800, - "waitTime" : 3, - "dnsServerMeasurement" : { - "usedDnsResponse" : { - "id" : 41837, - "qr" : "response", - "opcode" : "query", - "authoritativeAnswer" : false, - "truncation" : false, - "recursionDesired" : true, - "recursionAvailable" : true, - "zero" : false, - "authenticData" : false, - "checkingDisabled" : false, - "responseCode" : "noerror", - "question" : [ { - "name" : "www.example.com", - "type" : "a", - "class" : "in", - "ttl" : 0, - "data" : "" + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" } ], - "answer" : [ { - "name" : "www.example.com", - "type" : "a", - "class" : "in", - "ttl" : 300, - "data" : "203.0.113.10" + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" } ], - "dnsResolver" : "8.8.8.8", - "timing" : { - "startTimeUs" : "1769706600000000", - "totalTimeUs" : 19304 + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 }, - "protocol" : "udp" + "protocol" : "udp" }, - "unusedDnsResponses" : [ { - "id" : 41838, - "qr" : "response", - "opcode" : "query", - "authoritativeAnswer" : false, - "truncation" : false, - "recursionDesired" : true, - "recursionAvailable" : true, - "zero" : false, - "authenticData" : false, - "checkingDisabled" : false, - "responseCode" : "nxdomain", - "question" : [ { - "name" : "www.example.com", - "type" : "aaaa", - "class" : "in", - "ttl" : 0, - "data" : "" + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" } ], - "dnsResolver" : "8.8.4.4", - "timing" : { - "startTimeUs" : "1769706600020000", - "totalTimeUs" : 15420 + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 }, - "protocol" : "udp" + "protocol" : "udp" } ], - "usedHostsFile" : false, - "resolvedIp" : "203.0.113.10" + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" }, - "wireSize" : 9993, - "errorDetails" : "Connection error" + "wireSize" : 9993, + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -385,7 +390,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "instance" : "instance", @@ -409,13 +413,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -429,7 +439,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "error_description" : "Invalid access token", @@ -441,13 +450,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -461,7 +476,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "instance" : "instance", @@ -476,13 +490,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -496,7 +516,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "instance" : "instance", @@ -511,13 +530,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -531,7 +556,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "instance" : "instance", @@ -546,13 +570,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -566,7 +596,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "instance" : "instance", @@ -581,13 +610,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -601,7 +636,6 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): start_date = '2022-07-17T22:00:54Z' end_date = '2022-07-18T22:00:54Z' cursor = 'cursor_example' - expand = [thousandeyes_sdk.test_results.Expand()] error_body_json = """ { "instance" : "instance", @@ -616,13 +650,19 @@ class TestWebHTTPServerTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_http_server_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, - expand=expand, + _headers=self.te_headers("get_test_http_server_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py index 72edc963..79b7a674 100644 --- a/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py @@ -37,569 +37,574 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "numErrors" : 0, - "_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" + "numErrors" : 0, + "_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" } }, - "responseTime" : 34.35, - "pageLoadTime" : 352, - "numObjects" : 17, - "totalSize" : 403301, - "domLoadTime" : 352, - "har" : { - "log" : { - "creator" : { - "name" : "ThousandEyes DB Exporter" + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" }, - "entries" : [ { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "google.com" + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://google.com/" + "method" : "GET", + "url" : "https://google.com/" }, - "response" : { - "bodySize" : 220, - "content" : { - "mimeType" : "text/html", - "size" : 220 + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "public, max-age=2592000" + "name" : "cache-control", + "value" : "public, max-age=2592000" }, { - "name" : "content-length", - "value" : "220" + "name" : "content-length", + "value" : "220" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" }, { - "name" : "location", - "value" : "https://www.google.com/" + "name" : "location", + "value" : "https://www.google.com/" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "status", - "value" : "301" + "name" : "status", + "value" : "301" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 471, - "redirectURL" : "", - "status" : 301, - "statusText" : "MOVED_PERMANENTLY" + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" }, - "serverIPAddress" : "172.217.6.110", - "startedDateTime" : "2019-11-15T16:41:54.798Z", - "time" : 71, - "timings" : { - "blocked" : 2, - "connect" : 16, - "dns" : 1, - "receive" : 1, - "send" : 0, - "ssl" : 14, - "wait" : 50 + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 } }, { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "www.google.com" + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://www.google.com/" + "method" : "GET", + "url" : "https://www.google.com/" }, - "response" : { - "bodySize" : 65214, - "content" : { - "mimeType" : "text/html", - "size" : 225039 + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "private, max-age=0" + "name" : "cache-control", + "value" : "private, max-age=0" }, { - "name" : "content-encoding", - "value" : "br" + "name" : "content-encoding", + "value" : "br" }, { - "name" : "content-length", - "value" : "65214" + "name" : "content-length", + "value" : "65214" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "-1" + "name" : "expires", + "value" : "-1" }, { - "name" : "p3p", - "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "set-cookie", - "value" : "(removed)" + "name" : "set-cookie", + "value" : "(removed)" }, { - "name" : "status", - "value" : "200" + "name" : "status", + "value" : "200" }, { - "name" : "strict-transport-security", - "value" : "max-age=31536000" + "name" : "strict-transport-security", + "value" : "max-age=31536000" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 915, - "redirectURL" : "", - "status" : 200, - "statusText" : "OK" + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" }, - "serverIPAddress" : "172.217.4.196", - "startedDateTime" : "2019-11-15T16:41:54.870Z", - "time" : 182, - "timings" : { - "blocked" : 2, - "connect" : 4, - "dns" : 0, - "receive" : 58, - "send" : 0, - "ssl" : 2, - "wait" : 118 + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 } } ], - "pages" : [ { - "id" : "page_0", - "pageTimings" : { - "onContentLoad" : 367, - "onLoad" : 737 + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 }, - "responseCode" : 0, - "startedDateTime" : "2019-11-15T16:41:54.796Z", - "title" : "Google" + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" } ], - "version" : "1.2" + "version" : "1.2" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800 + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "numErrors" : 0, - "_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" + "numErrors" : 0, + "_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" } }, - "responseTime" : 34.35, - "pageLoadTime" : 352, - "numObjects" : 17, - "totalSize" : 403301, - "domLoadTime" : 352, - "har" : { - "log" : { - "creator" : { - "name" : "ThousandEyes DB Exporter" + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" }, - "entries" : [ { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "google.com" + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://google.com/" + "method" : "GET", + "url" : "https://google.com/" }, - "response" : { - "bodySize" : 220, - "content" : { - "mimeType" : "text/html", - "size" : 220 + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "public, max-age=2592000" + "name" : "cache-control", + "value" : "public, max-age=2592000" }, { - "name" : "content-length", - "value" : "220" + "name" : "content-length", + "value" : "220" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" }, { - "name" : "location", - "value" : "https://www.google.com/" + "name" : "location", + "value" : "https://www.google.com/" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "status", - "value" : "301" + "name" : "status", + "value" : "301" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 471, - "redirectURL" : "", - "status" : 301, - "statusText" : "MOVED_PERMANENTLY" + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" }, - "serverIPAddress" : "172.217.6.110", - "startedDateTime" : "2019-11-15T16:41:54.798Z", - "time" : 71, - "timings" : { - "blocked" : 2, - "connect" : 16, - "dns" : 1, - "receive" : 1, - "send" : 0, - "ssl" : 14, - "wait" : 50 + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 } }, { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "www.google.com" + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://www.google.com/" + "method" : "GET", + "url" : "https://www.google.com/" }, - "response" : { - "bodySize" : 65214, - "content" : { - "mimeType" : "text/html", - "size" : 225039 + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "private, max-age=0" + "name" : "cache-control", + "value" : "private, max-age=0" }, { - "name" : "content-encoding", - "value" : "br" + "name" : "content-encoding", + "value" : "br" }, { - "name" : "content-length", - "value" : "65214" + "name" : "content-length", + "value" : "65214" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "-1" + "name" : "expires", + "value" : "-1" }, { - "name" : "p3p", - "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "set-cookie", - "value" : "(removed)" + "name" : "set-cookie", + "value" : "(removed)" }, { - "name" : "status", - "value" : "200" + "name" : "status", + "value" : "200" }, { - "name" : "strict-transport-security", - "value" : "max-age=31536000" + "name" : "strict-transport-security", + "value" : "max-age=31536000" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 915, - "redirectURL" : "", - "status" : 200, - "statusText" : "OK" + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" }, - "serverIPAddress" : "172.217.4.196", - "startedDateTime" : "2019-11-15T16:41:54.870Z", - "time" : 182, - "timings" : { - "blocked" : 2, - "connect" : 4, - "dns" : 0, - "receive" : 58, - "send" : 0, - "ssl" : 2, - "wait" : 118 + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 } } ], - "pages" : [ { - "id" : "page_0", - "pageTimings" : { - "onContentLoad" : 367, - "onLoad" : 737 + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 }, - "responseCode" : 0, - "startedDateTime" : "2019-11-15T16:41:54.796Z", - "title" : "Google" + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" } ], - "version" : "1.2" + "version" : "1.2" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "roundId" : 1384309800 + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -634,10 +639,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -660,10 +670,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -689,10 +704,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -718,10 +738,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -747,10 +772,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -776,10 +806,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -805,10 +840,15 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_page_load_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_page_load_agent_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -826,141 +866,148 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "totalSize" : 403301, - "numErrors" : 0, - "_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" + "totalSize" : 403301, + "numErrors" : 0, + "_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" } }, - "responseTime" : 34.35, - "domLoadTime" : 352, - "startTime" : 1384309800, - "pageLoadTime" : 352, - "endTime" : 1384309800, - "roundId" : 1384309800, - "numObjects" : 17 + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "totalSize" : 403301, - "numErrors" : 0, - "_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" + "totalSize" : 403301, + "numErrors" : 0, + "_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" } }, - "responseTime" : 34.35, - "domLoadTime" : 352, - "startTime" : 1384309800, - "pageLoadTime" : 352, - "endTime" : 1384309800, - "roundId" : 1384309800, - "numObjects" : 17 + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -997,12 +1044,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1027,12 +1081,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1060,12 +1121,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1093,12 +1161,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1126,12 +1201,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1159,12 +1241,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1192,12 +1281,19 @@ class TestWebPageLoadTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_page_load_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_page_load_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py index dd9be272..ad56db30 100644 --- a/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py +++ b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py @@ -38,606 +38,612 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "componentErrors" : 5, - "errorType" : "None", - "transactionTime" : 2379, - "pages" : [ { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 }, { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 } ], - "har" : { - "log" : { - "creator" : { - "name" : "ThousandEyes DB Exporter" + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" }, - "entries" : [ { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "google.com" + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://google.com/" + "method" : "GET", + "url" : "https://google.com/" }, - "response" : { - "bodySize" : 220, - "content" : { - "mimeType" : "text/html", - "size" : 220 + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "public, max-age=2592000" + "name" : "cache-control", + "value" : "public, max-age=2592000" }, { - "name" : "content-length", - "value" : "220" + "name" : "content-length", + "value" : "220" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" }, { - "name" : "location", - "value" : "https://www.google.com/" + "name" : "location", + "value" : "https://www.google.com/" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "status", - "value" : "301" + "name" : "status", + "value" : "301" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 471, - "redirectURL" : "", - "status" : 301, - "statusText" : "MOVED_PERMANENTLY" + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" }, - "serverIPAddress" : "172.217.6.110", - "startedDateTime" : "2019-11-15T16:41:54.798Z", - "time" : 71, - "timings" : { - "blocked" : 2, - "connect" : 16, - "dns" : 1, - "receive" : 1, - "send" : 0, - "ssl" : 14, - "wait" : 50 + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 } }, { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "www.google.com" + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://www.google.com/" + "method" : "GET", + "url" : "https://www.google.com/" }, - "response" : { - "bodySize" : 65214, - "content" : { - "mimeType" : "text/html", - "size" : 225039 + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "private, max-age=0" + "name" : "cache-control", + "value" : "private, max-age=0" }, { - "name" : "content-encoding", - "value" : "br" + "name" : "content-encoding", + "value" : "br" }, { - "name" : "content-length", - "value" : "65214" + "name" : "content-length", + "value" : "65214" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "-1" + "name" : "expires", + "value" : "-1" }, { - "name" : "p3p", - "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "set-cookie", - "value" : "(removed)" + "name" : "set-cookie", + "value" : "(removed)" }, { - "name" : "status", - "value" : "200" + "name" : "status", + "value" : "200" }, { - "name" : "strict-transport-security", - "value" : "max-age=31536000" + "name" : "strict-transport-security", + "value" : "max-age=31536000" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 915, - "redirectURL" : "", - "status" : 200, - "statusText" : "OK" + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" }, - "serverIPAddress" : "172.217.4.196", - "startedDateTime" : "2019-11-15T16:41:54.870Z", - "time" : 182, - "timings" : { - "blocked" : 2, - "connect" : 4, - "dns" : 0, - "receive" : 58, - "send" : 0, - "ssl" : 2, - "wait" : 118 + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 } } ], - "pages" : [ { - "id" : "page_0", - "pageTimings" : { - "onContentLoad" : 367, - "onLoad" : 737 + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 }, - "responseCode" : 0, - "startedDateTime" : "2019-11-15T16:41:54.796Z", - "title" : "Google" + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" } ], - "version" : "1.2" + "version" : "1.2" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "markers" : [ { - "duration" : 1360, - "name" : "SearchForWebdriver" + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" }, { - "duration" : 1360, - "name" : "SearchForWebdriver" + "duration" : 1360, + "name" : "SearchForWebdriver" } ], - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "componentErrors" : 5, - "errorType" : "None", - "transactionTime" : 2379, - "pages" : [ { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 }, { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 } ], - "har" : { - "log" : { - "creator" : { - "name" : "ThousandEyes DB Exporter" + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" }, - "entries" : [ { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "google.com" + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://google.com/" + "method" : "GET", + "url" : "https://google.com/" }, - "response" : { - "bodySize" : 220, - "content" : { - "mimeType" : "text/html", - "size" : 220 + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "public, max-age=2592000" + "name" : "cache-control", + "value" : "public, max-age=2592000" }, { - "name" : "content-length", - "value" : "220" + "name" : "content-length", + "value" : "220" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" }, { - "name" : "location", - "value" : "https://www.google.com/" + "name" : "location", + "value" : "https://www.google.com/" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "status", - "value" : "301" + "name" : "status", + "value" : "301" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 471, - "redirectURL" : "", - "status" : 301, - "statusText" : "MOVED_PERMANENTLY" + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" }, - "serverIPAddress" : "172.217.6.110", - "startedDateTime" : "2019-11-15T16:41:54.798Z", - "time" : 71, - "timings" : { - "blocked" : 2, - "connect" : 16, - "dns" : 1, - "receive" : 1, - "send" : 0, - "ssl" : 14, - "wait" : 50 + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 } }, { - "pageref" : "page_0", - "request" : { - "headers" : [ { - "name" : ":authority", - "value" : "www.google.com" + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" }, { - "name" : ":method", - "value" : "GET" + "name" : ":method", + "value" : "GET" }, { - "name" : ":path", - "value" : "/" + "name" : ":path", + "value" : "/" }, { - "name" : ":scheme", - "value" : "https" + "name" : ":scheme", + "value" : "https" }, { - "name" : "accept", - "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, { - "name" : "accept-encoding", - "value" : "gzip, deflate, br" + "name" : "accept-encoding", + "value" : "gzip, deflate, br" }, { - "name" : "accept-language", - "value" : "en-US,en;q=0.9" + "name" : "accept-language", + "value" : "en-US,en;q=0.9" }, { - "name" : "upgrade-insecure-requests", - "value" : "1" + "name" : "upgrade-insecure-requests", + "value" : "1" }, { - "name" : "user-agent", - "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" }, { - "name" : "x-thousandeyes-agent", - "value" : "yes" + "name" : "x-thousandeyes-agent", + "value" : "yes" } ], - "method" : "GET", - "url" : "https://www.google.com/" + "method" : "GET", + "url" : "https://www.google.com/" }, - "response" : { - "bodySize" : 65214, - "content" : { - "mimeType" : "text/html", - "size" : 225039 + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 }, - "headers" : [ { - "name" : "alt-svc", - "value" : "quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000" + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" }, { - "name" : "cache-control", - "value" : "private, max-age=0" + "name" : "cache-control", + "value" : "private, max-age=0" }, { - "name" : "content-encoding", - "value" : "br" + "name" : "content-encoding", + "value" : "br" }, { - "name" : "content-length", - "value" : "65214" + "name" : "content-length", + "value" : "65214" }, { - "name" : "content-type", - "value" : "text/html; charset=UTF-8" + "name" : "content-type", + "value" : "text/html; charset=UTF-8" }, { - "name" : "date", - "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" }, { - "name" : "expires", - "value" : "-1" + "name" : "expires", + "value" : "-1" }, { - "name" : "p3p", - "value" : "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"" + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" }, { - "name" : "server", - "value" : "gws" + "name" : "server", + "value" : "gws" }, { - "name" : "set-cookie", - "value" : "(removed)" + "name" : "set-cookie", + "value" : "(removed)" }, { - "name" : "status", - "value" : "200" + "name" : "status", + "value" : "200" }, { - "name" : "strict-transport-security", - "value" : "max-age=31536000" + "name" : "strict-transport-security", + "value" : "max-age=31536000" }, { - "name" : "x-frame-options", - "value" : "SAMEORIGIN" + "name" : "x-frame-options", + "value" : "SAMEORIGIN" }, { - "name" : "x-xss-protection", - "value" : "0" + "name" : "x-xss-protection", + "value" : "0" } ], - "headersSize" : 915, - "redirectURL" : "", - "status" : 200, - "statusText" : "OK" + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" }, - "serverIPAddress" : "172.217.4.196", - "startedDateTime" : "2019-11-15T16:41:54.870Z", - "time" : 182, - "timings" : { - "blocked" : 2, - "connect" : 4, - "dns" : 0, - "receive" : 58, - "send" : 0, - "ssl" : 2, - "wait" : 118 + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 } } ], - "pages" : [ { - "id" : "page_0", - "pageTimings" : { - "onContentLoad" : 367, - "onLoad" : 737 + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 }, - "responseCode" : 0, - "startedDateTime" : "2019-11-15T16:41:54.796Z", - "title" : "Google" + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" } ], - "version" : "1.2" + "version" : "1.2" } }, - "startTime" : 1384309800, - "endTime" : 1384309800, - "markers" : [ { - "duration" : 1360, - "name" : "SearchForWebdriver" + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" }, { - "duration" : 1360, - "name" : "SearchForWebdriver" + "duration" : 1360, + "name" : "SearchForWebdriver" } ], - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -673,11 +679,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -701,11 +713,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -732,11 +750,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -763,11 +787,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -794,11 +824,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -825,11 +861,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -856,11 +898,17 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_web_transaction_agent_round_page_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + page_id=page_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -876,173 +924,178 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "pages" : [ { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 }, { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 } ], - "_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" + "_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" } }, - "componentErrors" : 5, - "errorType" : "None", - "startTime" : 1384309800, - "endTime" : 1384309800, - "transactionTime" : 2379, - "markers" : [ { - "duration" : 1360, - "name" : "SearchForWebdriver" + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" }, { - "duration" : 1360, - "name" : "SearchForWebdriver" + "duration" : 1360, + "name" : "SearchForWebdriver" } ], - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "pages" : [ { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 }, { - "duration" : 1117.5660001039505, - "componentCount" : 136, - "pageNum" : 0, - "pageName" : "Google", - "errorCount" : 0 + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 } ], - "_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" + "_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" } }, - "componentErrors" : 5, - "errorType" : "None", - "startTime" : 1384309800, - "endTime" : 1384309800, - "transactionTime" : 2379, - "markers" : [ { - "duration" : 1360, - "name" : "SearchForWebdriver" + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" }, { - "duration" : 1360, - "name" : "SearchForWebdriver" + "duration" : 1360, + "name" : "SearchForWebdriver" } ], - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1077,10 +1130,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1103,10 +1161,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1132,10 +1195,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1161,10 +1229,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1190,10 +1263,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1219,10 +1297,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1248,10 +1331,15 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_web_transaction_agent_round_results( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1269,137 +1357,144 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): cursor = 'cursor_example' response_body_json = """ { - "test" : { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" }, - "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" + "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" + "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" + "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" } }, - "results" : [ { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "componentErrors" : 5, - "errorType" : "None", - "startTime" : 1384309800, - "endTime" : 1384309800, - "transactionTime" : 2379, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" }, { - "date" : "2022-07-17T22:00:54Z", - "agent" : { - "agentId" : "281474976710706", - "agentName" : "thousandeyes-stg-va-254", - "location" : "San Francisco Bay Area", - "countryId" : "US" + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" }, - "_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" + "_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" } }, - "componentErrors" : 5, - "errorType" : "None", - "startTime" : 1384309800, - "endTime" : 1384309800, - "transactionTime" : 2379, - "roundId" : 1384309800, - "errorDetails" : "Connection error" + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" } ], - "startDate" : "2022-07-17T22:00:54Z" + "startDate" : "2022-07-17T22:00:54Z" } """ expected_response = json.loads(response_body_json) response = self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1436,12 +1531,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1466,12 +1568,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1499,12 +1608,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1532,12 +1648,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1565,12 +1688,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1598,12 +1728,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1631,12 +1768,19 @@ class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_test_web_transaction_results( + test_id=test_id, + aid=aid, + window=window, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_test_web_transaction_results", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py index 7a1bbfe7..84a945e8 100644 --- a/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py @@ -97,174 +97,175 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "agent-to-agent", - "mss" : 100, - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "throughputRate" : 10, - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "direction" : "to-target", - "throughputMeasurements" : false, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "throughputDuration" : 10000, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -338,7 +339,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -362,9 +362,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -438,7 +440,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -450,9 +451,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -526,7 +529,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -541,9 +543,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -617,7 +621,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -632,9 +635,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -708,7 +713,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -723,9 +727,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -799,7 +805,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -814,9 +819,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -890,7 +897,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): """ agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -905,9 +911,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_agent_to_agent_test( + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_agent_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -920,8 +928,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_agent_to_agent_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test"), ) self.assertEqual(204, response.status_code) @@ -943,8 +954,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -968,8 +982,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -993,8 +1010,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1018,8 +1038,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1043,8 +1066,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1068,8 +1094,11 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_agent_to_agent_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_agent_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1082,175 +1111,177 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "agent-to-agent", - "mss" : 100, - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "throughputRate" : 10, - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "direction" : "to-target", - "throughputMeasurements" : false, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "throughputDuration" : 10000, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1261,7 +1292,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1273,10 +1303,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1287,7 +1320,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1302,10 +1334,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1316,7 +1351,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1331,10 +1365,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1345,7 +1382,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1360,10 +1396,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1374,7 +1413,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1389,10 +1427,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1403,7 +1444,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1418,10 +1458,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_agent_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_agent_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1434,118 +1477,120 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "throughputRate" : 10, - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "direction" : "to-target", - "throughputMeasurements" : false, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "throughputDuration" : 10000, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "port" : 49153, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "targetAgentId" : "2954", - "interval" : 60, - "testId" : "281474976710706" + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" }, { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "throughputRate" : 10, - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "direction" : "to-target", - "throughputMeasurements" : false, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "throughputDuration" : 10000, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "port" : 49153, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "targetAgentId" : "2954", - "interval" : 60, - "testId" : "281474976710706" + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" } ], - "_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" + "_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_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1565,7 +1610,9 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1588,7 +1635,9 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1611,7 +1660,9 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1634,7 +1685,9 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1657,7 +1710,9 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1680,7 +1735,9 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_agent_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_agent_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1757,175 +1814,177 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "agent-to-agent", - "mss" : 100, - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "throughputRate" : 10, - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "direction" : "to-target", - "throughputMeasurements" : false, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "throughputDuration" : 10000, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2000,7 +2059,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2024,10 +2082,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2102,7 +2163,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2114,10 +2174,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2192,7 +2255,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2207,10 +2269,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2285,7 +2350,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2300,10 +2364,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2378,7 +2445,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2393,10 +2459,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2471,7 +2540,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2486,10 +2554,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2564,7 +2635,6 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): agent_to_agent_test_request = thousandeyes_sdk.tests.models.AgentToAgentTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2579,10 +2649,13 @@ class TestAgentToAgentTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_agent_to_agent_test( + test_id=test_id, + agent_to_agent_test_request=agent_to_agent_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_agent_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py index c771830a..47c8025a 100644 --- a/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py @@ -99,175 +99,176 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] 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" + "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" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "type" : "agent-to-server", - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "fixedPacketRate" : 25, - "protocol" : "tcp", - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : false, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "pingPayloadSize" : 112, - "continuousMode" : false, - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -343,7 +344,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -367,9 +367,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -445,7 +447,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -457,9 +458,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -535,7 +538,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -550,9 +552,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -628,7 +632,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -643,9 +646,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -721,7 +726,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -736,9 +740,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -814,7 +820,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -829,9 +834,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -907,7 +914,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): """ agent_to_server_test_request = thousandeyes_sdk.tests.models.AgentToServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -922,9 +928,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_agent_to_server_test( + agent_to_server_test_request=agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_agent_to_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -937,8 +945,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_agent_to_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test"), ) self.assertEqual(204, response.status_code) @@ -960,8 +971,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -985,8 +999,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1010,8 +1027,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1035,8 +1055,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1060,8 +1083,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1085,8 +1111,11 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_agent_to_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_agent_to_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1099,176 +1128,178 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] 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" + "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" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "type" : "agent-to-server", - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "fixedPacketRate" : 25, - "protocol" : "tcp", - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : false, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "pingPayloadSize" : 112, - "continuousMode" : false, - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1279,7 +1310,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1291,10 +1321,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1305,7 +1338,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1320,10 +1352,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1334,7 +1369,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1349,10 +1383,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1363,7 +1400,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1378,10 +1414,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1392,7 +1431,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1407,10 +1445,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1421,7 +1462,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1436,10 +1476,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_agent_to_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1452,120 +1495,122 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "server" : "www.thousandeyes.com:80", - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "fixedPacketRate" : 25, - "protocol" : "tcp", - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : false, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "pingPayloadSize" : 112, - "continuousMode" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false }, { - "server" : "www.thousandeyes.com:80", - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "fixedPacketRate" : 25, - "protocol" : "tcp", - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : false, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "pingPayloadSize" : 112, - "continuousMode" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false } ], - "_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" + "_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_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1585,7 +1630,9 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1608,7 +1655,9 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1631,7 +1680,9 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1654,7 +1705,9 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1677,7 +1730,9 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1700,7 +1755,9 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_agent_to_server_tests( + aid=aid, + _headers=self.te_headers("get_agent_to_server_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1754,176 +1811,178 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] 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" + "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" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "type" : "agent-to-server", - "usePublicBgp" : true, - "enabled" : true, - "dscpId" : "0", - "fixedPacketRate" : 25, - "protocol" : "tcp", - "dscp" : "Best Effort (DSCP 0)", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : false, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "pingPayloadSize" : 112, - "continuousMode" : false, - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1975,7 +2034,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1999,10 +2057,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2054,7 +2115,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2066,10 +2126,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2121,7 +2184,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2136,10 +2198,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2191,7 +2256,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2206,10 +2270,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2261,7 +2328,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2276,10 +2342,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2331,7 +2400,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2346,10 +2414,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2401,7 +2472,6 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): update_agent_to_server_test_request = thousandeyes_sdk.tests.models.UpdateAgentToServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2416,10 +2486,13 @@ class TestAgentToServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_agent_to_server_test( + test_id=test_id, + update_agent_to_server_test_request=update_agent_to_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_agent_to_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py index 7d809ede..2ff5379d 100644 --- a/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py @@ -197,274 +197,275 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "credentials" : [ "3247", "1051" ], - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "requests" : [ { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" }, { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" } ], - "type" : "api", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "protocol" : "tcp", - "collectProxyNetworkData" : false, - "followRedirects" : true, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "clientCertDomainsAllowList" : "www.thousandeyes.com", - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "overrideAgentProxy" : false, - "predefinedVariables" : [ { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" }, { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" } ], - "liveShare" : false, - "distributedTracing" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 19, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersionId" : "0", - "targetTime" : 1, - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -638,7 +639,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -662,9 +662,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -838,7 +840,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -850,9 +851,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1026,7 +1029,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1041,9 +1043,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1217,7 +1221,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1232,9 +1235,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1408,7 +1413,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1423,9 +1427,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1599,7 +1605,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1614,9 +1619,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1790,7 +1797,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): """ api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1805,9 +1811,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_api_test( + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_api_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1820,8 +1828,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_api_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test"), ) self.assertEqual(204, response.status_code) @@ -1843,8 +1854,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1868,8 +1882,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1893,8 +1910,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1918,8 +1938,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1943,8 +1966,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1968,8 +1994,11 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_api_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_api_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1982,275 +2011,277 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "credentials" : [ "3247", "1051" ], - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "requests" : [ { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" }, { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" } ], - "type" : "api", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "protocol" : "tcp", - "collectProxyNetworkData" : false, - "followRedirects" : true, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "clientCertDomainsAllowList" : "www.thousandeyes.com", - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "overrideAgentProxy" : false, - "predefinedVariables" : [ { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" }, { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" } ], - "liveShare" : false, - "distributedTracing" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 19, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersionId" : "0", - "targetTime" : 1, - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2261,7 +2292,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2273,10 +2303,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2287,7 +2320,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2302,10 +2334,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2316,7 +2351,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2331,10 +2365,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2345,7 +2382,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2360,10 +2396,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2374,7 +2413,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2389,10 +2427,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2403,7 +2444,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2418,10 +2458,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_api_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_api_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2434,302 +2477,304 @@ class TestAPITestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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", - "probeMode" : "auto", - "requests" : [ { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" }, { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" } ], - "type" : "api", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "collectProxyNetworkData" : false, - "followRedirects" : true, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "clientCertDomainsAllowList" : "www.thousandeyes.com", - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "overrideAgentProxy" : false, - "predefinedVariables" : [ { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" }, { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" } ], - "liveShare" : false, - "distributedTracing" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "timeLimit" : 19, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "overrideProxyId" : "281474976710706", - "sslVersionId" : "0", - "targetTime" : 1 + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 }, { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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", - "probeMode" : "auto", - "requests" : [ { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" }, { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" } ], - "type" : "api", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "collectProxyNetworkData" : false, - "followRedirects" : true, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "clientCertDomainsAllowList" : "www.thousandeyes.com", - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "overrideAgentProxy" : false, - "predefinedVariables" : [ { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" }, { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" } ], - "liveShare" : false, - "distributedTracing" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "timeLimit" : 19, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "overrideProxyId" : "281474976710706", - "sslVersionId" : "0", - "targetTime" : 1 + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 } ], - "_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" + "_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_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2749,7 +2794,9 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2772,7 +2819,9 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2795,7 +2844,9 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2818,7 +2869,9 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2841,7 +2894,9 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2864,7 +2919,9 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_api_tests( + aid=aid, + _headers=self.te_headers("get_api_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3041,275 +3098,277 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "credentials" : [ "3247", "1051" ], - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "requests" : [ { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" }, { - "headers" : [ { - "value" : "keep-alive", - "key" : "x-custom-header" + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" }, { - "value" : "keep-alive", - "key" : "x-custom-header" + "value" : "keep-alive", + "key" : "x-custom-header" } ], - "variables" : [ { - "name" : "myTestName", - "value" : "tests[0].name" + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" }, { - "name" : "myTestName", - "value" : "tests[0].name" + "name" : "myTestName", + "value" : "tests[0].name" } ], - "clientId" : "client-id", - "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", - "method" : "get", - "verifyCertificate" : false, - "body" : "body", - "url" : "https://api.thousandeyes.com/v7/status", - "password" : "basic_pw123", - "bearerToken" : "abcd-1234-...", - "scope" : "read, write, deploy", - "name" : "Step 1", - "waitTimeMs" : 0, - "clientAuthentication" : "basic-auth-header", - "clientSecret" : "client-secret", - "assertions" : [ { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" }, { - "name" : "status-code", - "value" : "200", - "operator" : "is" + "name" : "status-code", + "value" : "200", + "operator" : "is" } ], - "authType" : "none", - "collectApiResponse" : true, - "username" : "ThousandEyesUserName" + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" } ], - "type" : "api", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "protocol" : "tcp", - "collectProxyNetworkData" : false, - "followRedirects" : true, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "clientCertDomainsAllowList" : "www.thousandeyes.com", - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "overrideAgentProxy" : false, - "predefinedVariables" : [ { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" }, { - "name" : "myUsername", - "value" : "ThousandEyesAccountUserName" + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" } ], - "liveShare" : false, - "distributedTracing" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 19, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "sslVersionId" : "0", - "targetTime" : 1, - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -3484,7 +3543,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3508,10 +3566,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3686,7 +3747,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -3698,10 +3758,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3876,7 +3939,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3891,10 +3953,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4069,7 +4134,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -4084,10 +4148,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4262,7 +4329,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -4277,10 +4343,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4455,7 +4524,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -4470,10 +4538,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -4648,7 +4719,6 @@ class TestAPITestsApiIntegration(IntegrationTestBase): api_test_request = thousandeyes_sdk.tests.models.ApiTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -4663,10 +4733,13 @@ class TestAPITestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_api_test( + test_id=test_id, + api_test_request=api_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_api_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py index b44993e3..a77fddd4 100644 --- a/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py @@ -76,117 +76,118 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "prefix" : "prefix", - "savedEvent" : true, - "includeCoveredPrefixes" : true, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "bgp", - "usePublicBgp" : true, - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -239,7 +240,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -263,9 +263,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -318,7 +320,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -330,9 +331,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -385,7 +388,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -400,9 +402,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -455,7 +459,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -470,9 +473,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -525,7 +530,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -540,9 +544,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -595,7 +601,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -610,9 +615,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -665,7 +672,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """ bgp_test_request = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -680,9 +686,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_bgp_test( + bgp_test_request=bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_bgp_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -695,8 +703,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_bgp_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test"), ) self.assertEqual(204, response.status_code) @@ -718,8 +729,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -743,8 +757,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -768,8 +785,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -793,8 +813,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -818,8 +841,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -843,8 +869,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_bgp_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_bgp_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -856,117 +885,118 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test success path""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "prefix" : "prefix", - "savedEvent" : true, - "includeCoveredPrefixes" : true, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "bgp", - "usePublicBgp" : true, - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -976,7 +1006,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test error path (HTTP 401)""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -988,9 +1017,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1000,7 +1031,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test error path (HTTP 403)""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1015,9 +1045,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1027,7 +1059,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test error path (HTTP 404)""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1042,9 +1073,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1054,7 +1087,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test error path (HTTP 429)""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1069,9 +1101,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1081,7 +1115,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test error path (HTTP 500)""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1096,9 +1129,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1108,7 +1143,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): """Integration test for get_bgp_test error path (HTTP 502)""" test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1123,9 +1157,11 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_bgp_test( + test_id=test_id, + aid=aid, - expand=expand, + _headers=self.te_headers("get_bgp_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1138,90 +1174,92 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "prefix" : "prefix", - "savedEvent" : true, - "includeCoveredPrefixes" : true, - "description" : "ThousandEyes Test", - "type" : "bgp", - "usePublicBgp" : true, - "enabled" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" }, { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "prefix" : "prefix", - "savedEvent" : true, - "includeCoveredPrefixes" : true, - "description" : "ThousandEyes Test", - "type" : "bgp", - "usePublicBgp" : true, - "enabled" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } ], - "_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" + "_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_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1241,7 +1279,9 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1264,7 +1304,9 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1287,7 +1329,9 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1310,7 +1354,9 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1333,7 +1379,9 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1356,7 +1404,9 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_bgp_tests( + aid=aid, + _headers=self.te_headers("get_bgp_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1411,118 +1461,120 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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, - "prefix" : "prefix", - "savedEvent" : true, - "includeCoveredPrefixes" : true, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "bgp", - "usePublicBgp" : true, - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1575,7 +1627,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1599,10 +1650,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1655,7 +1709,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1667,10 +1720,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1723,7 +1779,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1738,10 +1793,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1794,7 +1852,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1809,10 +1866,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1865,7 +1925,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1880,10 +1939,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1936,7 +1998,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1951,10 +2012,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2007,7 +2071,6 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): update_bgp_test_request = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2022,10 +2085,13 @@ class TestBGPTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_bgp_test( + test_id=test_id, + update_bgp_test_request=update_bgp_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_bgp_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py index 360f2383..78862b4e 100644 --- a/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py @@ -98,181 +98,182 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "dnsTransportProtocol" : "udp", - "probeMode" : "auto", - "type" : "dns-server", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "fixedPacketRate" : 50, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "dnsServers" : [ { - "serverName" : "dns-example.net", - "serverId" : "1447" + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" }, { - "serverName" : "dns-example.net", - "serverId" : "1447" + "serverName" : "dns-example.net", + "serverId" : "1447" } ], - "alertsEnabled" : true, - "recursiveQueries" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "dnsQueryClass" : "in", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -347,7 +348,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -371,9 +371,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -448,7 +450,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -460,9 +461,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -537,7 +540,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -552,9 +554,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -629,7 +633,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -644,9 +647,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -721,7 +726,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -736,9 +740,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -813,7 +819,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -828,9 +833,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -905,7 +912,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): """ dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -920,9 +926,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_dns_server_test( + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -935,8 +943,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_dns_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test"), ) self.assertEqual(204, response.status_code) @@ -958,8 +969,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -983,8 +997,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1008,8 +1025,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1033,8 +1053,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1058,8 +1081,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1083,8 +1109,11 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_dns_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1097,182 +1126,184 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "dnsTransportProtocol" : "udp", - "probeMode" : "auto", - "type" : "dns-server", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "fixedPacketRate" : 50, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "dnsServers" : [ { - "serverName" : "dns-example.net", - "serverId" : "1447" + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" }, { - "serverName" : "dns-example.net", - "serverId" : "1447" + "serverName" : "dns-example.net", + "serverId" : "1447" } ], - "alertsEnabled" : true, - "recursiveQueries" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "dnsQueryClass" : "in", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1283,7 +1314,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1295,10 +1325,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1309,7 +1342,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1324,10 +1356,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1338,7 +1373,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1353,10 +1387,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1367,7 +1404,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1382,10 +1418,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1396,7 +1435,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1411,10 +1449,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1425,7 +1466,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1440,10 +1480,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dns_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1456,132 +1499,134 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "fixedPacketRate" : 50, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "dnsServers" : [ { - "serverName" : "dns-example.net", - "serverId" : "1447" + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" }, { - "serverName" : "dns-example.net", - "serverId" : "1447" + "serverName" : "dns-example.net", + "serverId" : "1447" } ], - "alertsEnabled" : true, - "recursiveQueries" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "dnsQueryClass" : "in", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "domain" : "www.thousandeyes.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706" + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" }, { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "fixedPacketRate" : 50, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "dnsServers" : [ { - "serverName" : "dns-example.net", - "serverId" : "1447" + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" }, { - "serverName" : "dns-example.net", - "serverId" : "1447" + "serverName" : "dns-example.net", + "serverId" : "1447" } ], - "alertsEnabled" : true, - "recursiveQueries" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "dnsQueryClass" : "in", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "domain" : "www.thousandeyes.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706" + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" } ], - "_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" + "_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_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1601,7 +1646,9 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1624,7 +1671,9 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1647,7 +1696,9 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1670,7 +1721,9 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1693,7 +1746,9 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1716,7 +1771,9 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dns_server_tests( + aid=aid, + _headers=self.te_headers("get_dns_server_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1794,182 +1851,184 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "dnsTransportProtocol" : "udp", - "probeMode" : "auto", - "type" : "dns-server", - "usePublicBgp" : true, - "enabled" : true, - "protocol" : "tcp", - "fixedPacketRate" : 50, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "dnsServers" : [ { - "serverName" : "dns-example.net", - "serverId" : "1447" + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" }, { - "serverName" : "dns-example.net", - "serverId" : "1447" + "serverName" : "dns-example.net", + "serverId" : "1447" } ], - "alertsEnabled" : true, - "recursiveQueries" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "dnsQueryClass" : "in", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2045,7 +2104,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2069,10 +2127,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2148,7 +2209,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2160,10 +2220,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2239,7 +2302,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2254,10 +2316,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2333,7 +2398,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2348,10 +2412,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2427,7 +2494,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2442,10 +2508,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2521,7 +2590,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2536,10 +2604,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2615,7 +2686,6 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): dns_server_test_request = thousandeyes_sdk.tests.models.DnsServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2630,10 +2700,13 @@ class TestDNSServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_dns_server_test( + test_id=test_id, + dns_server_test_request=dns_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py index f8a9ed68..6640de03 100644 --- a/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py @@ -84,147 +84,148 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "savedEvent" : true, - "description" : "ThousandEyes Test", - "dnsTransportProtocol" : "udp", - "type" : "dns-trace", - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } """ expected_response = json.loads(response_body_json) response = self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -285,7 +286,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -309,9 +309,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -372,7 +374,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -384,9 +385,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -447,7 +450,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -462,9 +464,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -525,7 +529,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -540,9 +543,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -603,7 +608,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -618,9 +622,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -681,7 +687,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -696,9 +701,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -759,7 +766,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): """ dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -774,9 +780,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_dns_trace_test( + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_trace_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -789,8 +797,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_dns_trace_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test"), ) self.assertEqual(204, response.status_code) @@ -812,8 +823,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -837,8 +851,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -862,8 +879,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -887,8 +907,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -912,8 +935,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -937,8 +963,11 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_dns_trace_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_trace_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -951,148 +980,150 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "savedEvent" : true, - "description" : "ThousandEyes Test", - "dnsTransportProtocol" : "udp", - "type" : "dns-trace", - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } """ expected_response = json.loads(response_body_json) response = self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1103,7 +1134,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1115,10 +1145,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1129,7 +1162,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1144,10 +1176,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1158,7 +1193,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1173,10 +1207,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1187,7 +1224,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1202,10 +1238,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1216,7 +1255,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1231,10 +1269,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1245,7 +1286,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1260,10 +1300,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dns_trace_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_trace_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1276,94 +1319,96 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "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" + "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" + "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", - "enabled" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "domain" : "www.thousandeyes.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" }, { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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", - "enabled" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "domain" : "www.thousandeyes.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } ], - "_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" + "_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_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1383,7 +1428,9 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1406,7 +1453,9 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1429,7 +1478,9 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1452,7 +1503,9 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1475,7 +1528,9 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1498,7 +1553,9 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dns_trace_tests( + aid=aid, + _headers=self.te_headers("get_dns_trace_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1562,148 +1619,150 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "savedEvent" : true, - "description" : "ThousandEyes Test", - "dnsTransportProtocol" : "udp", - "type" : "dns-trace", - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } """ expected_response = json.loads(response_body_json) response = self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1765,7 +1824,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1789,10 +1847,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1854,7 +1915,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1866,10 +1926,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1931,7 +1994,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1946,10 +2008,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2011,7 +2076,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2026,10 +2090,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2091,7 +2158,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2106,10 +2172,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2171,7 +2240,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2186,10 +2254,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2251,7 +2322,6 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): dns_trace_test_request = thousandeyes_sdk.tests.models.DnsTraceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2266,10 +2336,13 @@ class TestDNSTraceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_dns_trace_test( + test_id=test_id, + dns_trace_test_request=dns_trace_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_trace_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py index 9658965d..814db727 100644 --- a/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py @@ -83,146 +83,147 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "savedEvent" : true, - "description" : "ThousandEyes Test", - "type" : "dnssec", - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } """ expected_response = json.loads(response_body_json) response = self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -282,7 +283,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -306,9 +306,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -368,7 +370,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -380,9 +381,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -442,7 +445,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -457,9 +459,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -519,7 +523,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -534,9 +537,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -596,7 +601,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -611,9 +615,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -673,7 +679,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -688,9 +693,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -750,7 +757,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): """ dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -765,9 +771,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_dns_sec_test( + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_dns_sec_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -780,8 +788,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_dns_sec_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test"), ) self.assertEqual(204, response.status_code) @@ -803,8 +814,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -828,8 +842,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -853,8 +870,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -878,8 +898,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -903,8 +926,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -928,8 +954,11 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_dns_sec_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_dns_sec_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -942,147 +971,149 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "savedEvent" : true, - "description" : "ThousandEyes Test", - "type" : "dnssec", - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } """ expected_response = json.loads(response_body_json) response = self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1093,7 +1124,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1105,10 +1135,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1119,7 +1152,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1134,10 +1166,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1148,7 +1183,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1163,10 +1197,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1177,7 +1214,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1192,10 +1228,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1206,7 +1245,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1221,10 +1259,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1235,7 +1276,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1250,10 +1290,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dns_sec_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_dns_sec_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1266,92 +1309,94 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "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" + "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" + "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", - "enabled" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "domain" : "www.thousandeyes.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" }, { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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", - "enabled" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "domain" : "www.thousandeyes.com", - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } ], - "_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" + "_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_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1371,7 +1416,9 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1394,7 +1441,9 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1417,7 +1466,9 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1440,7 +1491,9 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1463,7 +1516,9 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1486,7 +1541,9 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_dns_sec_tests( + aid=aid, + _headers=self.te_headers("get_dns_sec_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1549,147 +1606,149 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "dnsQueryClass" : "in", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "savedEvent" : true, - "description" : "ThousandEyes Test", - "type" : "dnssec", - "enabled" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "modifiedBy" : "user@user.com", - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "alertsEnabled" : true, - "testName" : "ThousandEyes Test" + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" } """ expected_response = json.loads(response_body_json) response = self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1750,7 +1809,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1774,10 +1832,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1838,7 +1899,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1850,10 +1910,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1914,7 +1977,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1929,10 +1991,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1993,7 +2058,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2008,10 +2072,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2072,7 +2139,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2087,10 +2153,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2151,7 +2220,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2166,10 +2234,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2230,7 +2301,6 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): dns_sec_test_request = thousandeyes_sdk.tests.models.DnsSecTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2245,10 +2315,13 @@ class TestDNSSECTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_dns_sec_test( + test_id=test_id, + dns_sec_test_request=dns_sec_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_dns_sec_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py index 19a88ead..d9f18b08 100644 --- a/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py @@ -102,179 +102,180 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "downloadLimit" : 1048576, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "useExplicitFtps" : false, - "probeMode" : "auto", - "type" : "ftp-server", - "usePublicBgp" : true, - "enabled" : true, - "password" : "password", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "ftpTargetTime" : 1400, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "requestType" : "download", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "useActiveFtp" : false, - "username" : "username", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -353,7 +354,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -377,9 +377,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -458,7 +460,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -470,9 +471,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -551,7 +554,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -566,9 +568,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -647,7 +651,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -662,9 +665,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -743,7 +748,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -758,9 +762,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -839,7 +845,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -854,9 +859,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -935,7 +942,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): """ ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -950,9 +956,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_ftp_server_test( + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_ftp_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -965,8 +973,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_ftp_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test"), ) self.assertEqual(204, response.status_code) @@ -988,8 +999,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1013,8 +1027,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1038,8 +1055,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1063,8 +1083,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1088,8 +1111,11 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_ftp_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_ftp_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1102,180 +1128,182 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "downloadLimit" : 1048576, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "useExplicitFtps" : false, - "probeMode" : "auto", - "type" : "ftp-server", - "usePublicBgp" : true, - "enabled" : true, - "password" : "password", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "ftpTargetTime" : 1400, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "requestType" : "download", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "useActiveFtp" : false, - "username" : "username", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1286,7 +1314,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1298,10 +1325,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1312,7 +1342,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1327,10 +1356,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1341,7 +1373,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1356,10 +1387,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1370,7 +1404,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1385,10 +1418,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1399,7 +1435,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1414,10 +1449,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1428,7 +1466,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1443,10 +1480,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_ftp_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_ftp_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1459,128 +1499,130 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "password" : "password", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "ftpTargetTime" : 1400, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "requestType" : "download", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "ftpTimeLimit" : 10, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "useActiveFtp" : false, - "username" : "username" + "downloadLimit" : 1048576, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" }, { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "password" : "password", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "ftpTargetTime" : 1400, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "requestType" : "download", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "ftpTimeLimit" : 10, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "testId" : "281474976710706", - "useActiveFtp" : false, - "username" : "username" + "downloadLimit" : 1048576, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" } ], - "_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" + "_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_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1600,7 +1642,9 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1623,7 +1667,9 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1646,7 +1692,9 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1669,7 +1717,9 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1692,7 +1742,9 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1715,7 +1767,9 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_ftp_server_tests( + aid=aid, + _headers=self.te_headers("get_ftp_server_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1797,180 +1851,182 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "downloadLimit" : 1048576, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "bandwidthMeasurements" : true, - "description" : "ThousandEyes Test", - "useExplicitFtps" : false, - "probeMode" : "auto", - "type" : "ftp-server", - "usePublicBgp" : true, - "enabled" : true, - "password" : "password", - "protocol" : "tcp", - "fixedPacketRate" : 50, - "ftpTargetTime" : 1400, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "requestType" : "download", - "liveShare" : false, - "savedEvent" : true, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "useActiveFtp" : false, - "username" : "username", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2050,7 +2106,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2074,10 +2129,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2157,7 +2215,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2169,10 +2226,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2252,7 +2312,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2267,10 +2326,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2350,7 +2412,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2365,10 +2426,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2448,7 +2512,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2463,10 +2526,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2546,7 +2612,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2561,10 +2626,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2644,7 +2712,6 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ftp_server_test_request = thousandeyes_sdk.tests.models.FtpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2659,10 +2726,13 @@ class TestFTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_ftp_server_test( + test_id=test_id, + ftp_server_test_request=ftp_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_ftp_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py index 665cb219..ea6d9e2a 100644 --- a/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py @@ -153,230 +153,231 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "http-server", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "contentRegex" : "(regex)+", - "testName" : "ThousandEyes Test", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "ipv6Policy" : "use-agent-policy", - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "requestMethod" : "get", - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "headers" : [ "header1: value1", "header2: value2" ], - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "postBody" : "{ \"example\" : \"value\"}", - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -506,7 +507,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -530,9 +530,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -662,7 +664,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -674,9 +675,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -806,7 +809,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -821,9 +823,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -953,7 +957,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -968,9 +971,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1100,7 +1105,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1115,9 +1119,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1247,7 +1253,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1262,9 +1267,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1394,7 +1401,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): """ http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1409,9 +1415,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_http_server_test( + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_http_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1424,8 +1432,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_http_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test"), ) self.assertEqual(204, response.status_code) @@ -1447,8 +1458,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1472,8 +1486,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1497,8 +1514,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1522,8 +1542,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1547,8 +1570,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1572,8 +1598,11 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_http_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_http_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1586,231 +1615,233 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "http-server", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "contentRegex" : "(regex)+", - "testName" : "ThousandEyes Test", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "ipv6Policy" : "use-agent-policy", - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "requestMethod" : "get", - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "headers" : [ "header1: value1", "header2: value2" ], - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "postBody" : "{ \"example\" : \"value\"}", - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1821,7 +1852,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1833,10 +1863,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1847,7 +1880,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1862,10 +1894,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1876,7 +1911,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1891,10 +1925,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1905,7 +1942,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1920,10 +1956,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1934,7 +1973,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1949,10 +1987,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1963,7 +2004,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1978,10 +2018,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_http_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_http_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1994,230 +2037,232 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "http-server", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "contentRegex" : "(regex)+", - "testName" : "ThousandEyes Test", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "ipv6Policy" : "use-agent-policy", - "downloadLimit" : 2048, - "requestMethod" : "get", - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "headers" : [ "header1: value1", "header2: value2" ], - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "createdDate" : "2022-07-17T22:00:54Z", - "postBody" : "{ \"example\" : \"value\"}", - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" }, { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "http-server", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "contentRegex" : "(regex)+", - "testName" : "ThousandEyes Test", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "ipv6Policy" : "use-agent-policy", - "downloadLimit" : 2048, - "requestMethod" : "get", - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "headers" : [ "header1: value1", "header2: value2" ], - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "createdDate" : "2022-07-17T22:00:54Z", - "postBody" : "{ \"example\" : \"value\"}", - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } ], - "_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" + "_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_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2237,7 +2282,9 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2260,7 +2307,9 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2283,7 +2332,9 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2306,7 +2357,9 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2329,7 +2382,9 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2352,7 +2407,9 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_http_server_tests( + aid=aid, + _headers=self.te_headers("get_http_server_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2485,231 +2542,233 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "http-server", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "contentRegex" : "(regex)+", - "testName" : "ThousandEyes Test", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "ipv6Policy" : "use-agent-policy", - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "requestMethod" : "get", - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "headers" : [ "header1: value1", "header2: value2" ], - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "postBody" : "{ \"example\" : \"value\"}", - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2840,7 +2899,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2864,10 +2922,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2998,7 +3059,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -3010,10 +3070,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3144,7 +3207,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3159,10 +3221,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3293,7 +3358,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3308,10 +3372,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3442,7 +3509,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3457,10 +3523,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3591,7 +3660,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3606,10 +3674,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3740,7 +3811,6 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): http_server_test_request = thousandeyes_sdk.tests.models.HttpServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3755,10 +3825,13 @@ class TestHTTPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_http_server_test( + test_id=test_id, + http_server_test_request=http_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_http_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py index 1a222235..b8d56e61 100644 --- a/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py @@ -163,240 +163,241 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "page-load", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "httpInterval" : 120, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "pageLoadTargetTime" : 10, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "pageLoadTimeLimit" : 10, - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -536,7 +537,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -560,9 +560,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -702,7 +704,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -714,9 +715,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -856,7 +859,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -871,9 +873,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1013,7 +1017,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1028,9 +1031,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1170,7 +1175,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1185,9 +1189,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1327,7 +1333,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1342,9 +1347,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1484,7 +1491,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): """ page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1499,9 +1505,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_page_load_test( + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_page_load_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1514,8 +1522,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_page_load_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test"), ) self.assertEqual(204, response.status_code) @@ -1537,8 +1548,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1562,8 +1576,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1587,8 +1604,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1612,8 +1632,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1637,8 +1660,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1662,8 +1688,11 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_page_load_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_page_load_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1676,241 +1705,243 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "page-load", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "httpInterval" : 120, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "pageLoadTargetTime" : 10, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "pageLoadTimeLimit" : 10, - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1921,7 +1952,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1933,10 +1963,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1947,7 +1980,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1962,10 +1994,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1976,7 +2011,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1991,10 +2025,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2005,7 +2042,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2020,10 +2056,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2034,7 +2073,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2049,10 +2087,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2063,7 +2104,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2078,10 +2118,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_page_load_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_page_load_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2094,250 +2137,252 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "page-load", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "httpInterval" : 120, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "pageLoadTargetTime" : 10, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "pageLoadTimeLimit" : 10, - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" }, { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "page-load", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "httpInterval" : 120, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "pageLoadTargetTime" : 10, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "pageLoadTimeLimit" : 10, - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } ], - "_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" + "_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_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2357,7 +2402,9 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2380,7 +2427,9 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2403,7 +2452,9 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2426,7 +2477,9 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2449,7 +2502,9 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2472,7 +2527,9 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_page_load_tests( + aid=aid, + _headers=self.te_headers("get_page_load_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2615,241 +2672,243 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "page-load", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "httpInterval" : 120, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "pageLoadTargetTime" : 10, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "pageLoadTimeLimit" : 10, - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username" + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" } """ expected_response = json.loads(response_body_json) response = self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2990,7 +3049,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3014,10 +3072,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3158,7 +3219,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -3170,10 +3230,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3314,7 +3377,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3329,10 +3391,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3473,7 +3538,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3488,10 +3552,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3632,7 +3699,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3647,10 +3713,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3791,7 +3860,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3806,10 +3874,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3950,7 +4021,6 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3965,10 +4035,13 @@ class TestPageLoadTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_page_load_test( + test_id=test_id, + page_load_test_request=page_load_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_page_load_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py b/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py index 66b10d05..71f3d786 100644 --- a/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py @@ -46,17 +46,20 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "groupName" : "PathVis Interface Group", - "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], - "groupId" : "281474976710706", - "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], - "aid" : "1234" + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" } """ expected_response = json.loads(response_body_json) response = self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -100,8 +103,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -133,8 +139,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -169,8 +178,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -205,8 +217,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -241,8 +256,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -277,8 +295,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -313,8 +334,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_path_vis_interface_groups( + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("create_path_vis_interface_groups", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -327,8 +351,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): interface_group_id = '281474976710706' aid = '1234' response = self.api.delete_path_vis_interface_group_with_http_info( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group"), ) self.assertEqual(204, response.status_code) @@ -350,8 +377,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -375,8 +405,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -400,8 +433,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -425,8 +461,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -450,8 +489,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -475,8 +517,11 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_path_vis_interface_group( + interface_group_id=interface_group_id, + aid=aid, + _headers=self.te_headers("delete_path_vis_interface_group", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -489,36 +534,38 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "pathVisInterfaceGroups" : [ { - "groupName" : "PathVis Interface Group", - "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], - "groupId" : "281474976710706", - "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], - "aid" : "1234" + "pathVisInterfaceGroups" : [ { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" }, { - "groupName" : "PathVis Interface Group", - "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], - "groupId" : "281474976710706", - "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], - "aid" : "1234" + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" } ], - "_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" + "_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_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -538,7 +585,9 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -561,7 +610,9 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -584,7 +635,9 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -607,7 +660,9 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -630,7 +685,9 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -653,7 +710,9 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_path_vis_interface_groups( + aid=aid, + _headers=self.te_headers("get_path_vis_interface_groups", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -679,18 +738,22 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "groupName" : "PathVis Interface Group", - "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], - "groupId" : "281474976710706", - "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], - "aid" : "1234" + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" } """ expected_response = json.loads(response_body_json) response = self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -735,9 +798,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -770,9 +837,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -808,9 +879,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -846,9 +921,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -884,9 +963,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -922,9 +1005,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -960,9 +1047,13 @@ class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_path_vis_interface_group( + interface_group_id=interface_group_id, + interface_group=interface_group, + aid=aid, + _headers=self.te_headers("update_path_vis_interface_group", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py index b9807590..37366e48 100644 --- a/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py @@ -103,178 +103,179 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "registerEnabled" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "type" : "sip-server", - "authUser" : "username", - "usePublicBgp" : true, - "enabled" : true, - "fixedPacketRate" : 50, - "password" : "password", - "protocol" : "tcp", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "sipTargetTime" : 1000, - "bgpMeasurements" : true, - "numPathTraces" : 3, - "optionsRegex" : "[\"a-z\"]", - "liveShare" : false, - "savedEvent" : true, - "sipRegistrar" : "voice.thousandeyes.com", - "networkMeasurements" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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, - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "user" : "username", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -354,7 +355,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -378,9 +378,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -460,7 +462,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -472,9 +473,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -554,7 +557,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -569,9 +571,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -651,7 +655,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -666,9 +669,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -748,7 +753,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -763,9 +767,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -845,7 +851,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -860,9 +865,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -942,7 +949,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): """ sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -957,9 +963,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_sip_server_test( + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_sip_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -972,8 +980,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_sip_server_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test"), ) self.assertEqual(204, response.status_code) @@ -995,8 +1006,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1020,8 +1034,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1045,8 +1062,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1070,8 +1090,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1095,8 +1118,11 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_sip_server_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_sip_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1109,179 +1135,181 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "registerEnabled" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "type" : "sip-server", - "authUser" : "username", - "usePublicBgp" : true, - "enabled" : true, - "fixedPacketRate" : 50, - "password" : "password", - "protocol" : "tcp", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "sipTargetTime" : 1000, - "bgpMeasurements" : true, - "numPathTraces" : 3, - "optionsRegex" : "[\"a-z\"]", - "liveShare" : false, - "savedEvent" : true, - "sipRegistrar" : "voice.thousandeyes.com", - "networkMeasurements" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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, - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "user" : "username", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1292,7 +1320,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1304,10 +1331,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1318,7 +1348,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1333,10 +1362,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1347,7 +1379,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1362,10 +1393,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1376,7 +1410,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1391,10 +1424,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1405,7 +1441,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1420,10 +1455,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1434,7 +1472,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1449,10 +1486,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_sip_server_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_sip_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1465,126 +1505,128 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "fixedPacketRate" : 50, - "password" : "password", - "protocol" : "tcp", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "sipTargetTime" : 1000, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "optionsRegex" : "[\"a-z\"]", - "liveShare" : false, - "savedEvent" : true, - "sipRegistrar" : "voice.thousandeyes.com", - "networkMeasurements" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "port" : 49153, - "modifiedDate" : "2022-07-17T22:00:54Z", - "sipTimeLimit" : 5, - "interval" : 60, - "testId" : "281474976710706", - "user" : "username" + "registerEnabled" : false, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" }, { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "fixedPacketRate" : 50, - "password" : "password", - "protocol" : "tcp", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "sipTargetTime" : 1000, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "optionsRegex" : "[\"a-z\"]", - "liveShare" : false, - "savedEvent" : true, - "sipRegistrar" : "voice.thousandeyes.com", - "networkMeasurements" : true, - "createdDate" : "2022-07-17T22:00:54Z", - "createdBy" : "user@user.com", - "randomizedStartTime" : false, - "port" : 49153, - "modifiedDate" : "2022-07-17T22:00:54Z", - "sipTimeLimit" : 5, - "interval" : 60, - "testId" : "281474976710706", - "user" : "username" + "registerEnabled" : false, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" } ], - "_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" + "_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_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1604,7 +1646,9 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1627,7 +1671,9 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1650,7 +1696,9 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1673,7 +1721,9 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1696,7 +1746,9 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1719,7 +1771,9 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_sip_server_tests( + aid=aid, + _headers=self.te_headers("get_sip_server_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1802,179 +1856,181 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "mtuMeasurements" : false, - "ipv6Policy" : "use-agent-policy", - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "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" + "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" + "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, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "registerEnabled" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "probeMode" : "auto", - "type" : "sip-server", - "authUser" : "username", - "usePublicBgp" : true, - "enabled" : true, - "fixedPacketRate" : 50, - "password" : "password", - "protocol" : "tcp", - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "sipTargetTime" : 1000, - "bgpMeasurements" : true, - "numPathTraces" : 3, - "optionsRegex" : "[\"a-z\"]", - "liveShare" : false, - "savedEvent" : true, - "sipRegistrar" : "voice.thousandeyes.com", - "networkMeasurements" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "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 + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false } ], - "tags" : [ { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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, - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "user" : "username", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2055,7 +2111,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2079,10 +2134,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2163,7 +2221,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2175,10 +2232,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2259,7 +2319,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2274,10 +2333,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2358,7 +2420,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2373,10 +2434,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2457,7 +2521,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2472,10 +2535,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2556,7 +2622,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2571,10 +2636,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2655,7 +2723,6 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): sip_server_test_request = thousandeyes_sdk.tests.models.SipServerTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2670,10 +2737,13 @@ class TestSIPServerTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_sip_server_test( + test_id=test_id, + sip_server_test_request=sip_server_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_sip_server_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_tests_api_integration.py index 3f595bb1..c06af4e5 100644 --- a/thousandeyes-sdk-tests/test/test_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_tests_api_integration.py @@ -36,36 +36,40 @@ class TestTestsApiIntegration(IntegrationTestBase): limit = 50 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" + "_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" } }, - "testVersionHistory" : [ { - "versionId" : "1234", - "versionTimestamp" : "2022-07-17T22:00:54Z", - "createdBy" : "user (user@user.com)", - "testId" : "474276" + "testVersionHistory" : [ { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" }, { - "versionId" : "1234", - "versionTimestamp" : "2022-07-17T22:00:54Z", - "createdBy" : "user (user@user.com)", - "testId" : "474276" + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -87,9 +91,13 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -114,9 +122,13 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -141,9 +153,13 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -168,9 +184,13 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_test_version_history( + test_id=test_id, + aid=aid, + limit=limit, + _headers=self.te_headers("get_test_version_history", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -183,86 +203,88 @@ class TestTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" + "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" : { - "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" + "_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_tests( + aid=aid, + _headers=self.te_headers("get_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -282,7 +304,9 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -305,7 +329,9 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -328,7 +354,9 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -351,7 +379,9 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -374,7 +404,9 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -397,7 +429,9 @@ class TestTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_tests( + aid=aid, + _headers=self.te_headers("get_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py index 57835ee1..1642afbc 100644 --- a/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py @@ -93,170 +93,171 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "voice", - "usePublicBgp" : true, - "enabled" : true, - "jitterBuffer" : 40, - "dscpId" : "0", - "duration" : 5, - "dscp" : "Best Effort (DSCP 0)", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -326,7 +327,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -350,9 +350,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -422,7 +424,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -434,9 +435,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -506,7 +509,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -521,9 +523,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -593,7 +597,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -608,9 +611,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -680,7 +685,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -695,9 +699,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -767,7 +773,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -782,9 +787,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -854,7 +861,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): """ voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -869,9 +875,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_voice_test( + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_voice_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -884,8 +892,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_voice_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test"), ) self.assertEqual(204, response.status_code) @@ -907,8 +918,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -932,8 +946,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -957,8 +974,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -982,8 +1002,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1007,8 +1030,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1032,8 +1058,11 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_voice_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_voice_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1046,171 +1075,173 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "voice", - "usePublicBgp" : true, - "enabled" : true, - "jitterBuffer" : 40, - "dscpId" : "0", - "duration" : 5, - "dscp" : "Best Effort (DSCP 0)", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1221,7 +1252,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1233,10 +1263,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1247,7 +1280,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1262,10 +1294,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1276,7 +1311,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1291,10 +1325,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1305,7 +1342,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1320,10 +1356,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1334,7 +1373,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1349,10 +1387,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1363,7 +1404,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1378,10 +1418,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_voice_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_voice_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1394,110 +1437,112 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "jitterBuffer" : 40, - "dscpId" : "0", - "duration" : 5, - "dscp" : "Best Effort (DSCP 0)", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : 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", - "interval" : 60, - "testId" : "281474976710706" + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : 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", + "interval" : 60, + "testId" : "281474976710706" }, { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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", - "usePublicBgp" : true, - "enabled" : true, - "jitterBuffer" : 40, - "dscpId" : "0", - "duration" : 5, - "dscp" : "Best Effort (DSCP 0)", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : 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", - "interval" : 60, - "testId" : "281474976710706" + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : 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", + "interval" : 60, + "testId" : "281474976710706" } ], - "_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" + "_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_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1517,7 +1562,9 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1540,7 +1587,9 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1563,7 +1612,9 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1586,7 +1637,9 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1609,7 +1662,9 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1632,7 +1687,9 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_voice_tests( + aid=aid, + _headers=self.te_headers("get_voice_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1705,171 +1762,173 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "type" : "voice", - "usePublicBgp" : true, - "enabled" : true, - "jitterBuffer" : 40, - "dscpId" : "0", - "duration" : 5, - "dscp" : "Best Effort (DSCP 0)", - "modifiedBy" : "user@user.com", - "alertsEnabled" : true, - "testName" : "ThousandEyes Test", - "numPathTraces" : 3, - "bgpMeasurements" : true, - "liveShare" : false, - "savedEvent" : true, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "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 + "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" + "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 + "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 + "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" + "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 + "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", - "interval" : 60, - "testId" : "281474976710706", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "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", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ] } """ expected_response = json.loads(response_body_json) response = self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1940,7 +1999,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1964,10 +2022,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2038,7 +2099,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -2050,10 +2110,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2124,7 +2187,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2139,10 +2201,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2213,7 +2278,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2228,10 +2292,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2302,7 +2369,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2317,10 +2383,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2391,7 +2460,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2406,10 +2474,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2480,7 +2551,6 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): voice_test_request = thousandeyes_sdk.tests.models.VoiceTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2495,10 +2565,13 @@ class TestVoiceTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_voice_test( + test_id=test_id, + voice_test_request=voice_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_voice_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py index b0f5f56f..d6ec8962 100644 --- a/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py +++ b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py @@ -164,241 +164,242 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "web-transactions", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "credentials" : [ "3247", "1051" ], - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "transactionScript" : "if (true) { return true; }", - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 30, - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username", - "targetTime" : 1 + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 } """ expected_response = json.loads(response_body_json) response = self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -539,7 +540,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -563,9 +563,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -706,7 +708,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -718,9 +719,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -861,7 +864,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -876,9 +878,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1019,7 +1023,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1034,9 +1037,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1177,7 +1182,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1192,9 +1196,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1335,7 +1341,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1350,9 +1355,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1493,7 +1500,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): """ web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1508,9 +1514,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.create_web_transactions_test( + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("create_web_transactions_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1523,8 +1531,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' response = self.api.delete_web_transactions_test_with_http_info( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test"), ) self.assertEqual(204, response.status_code) @@ -1546,8 +1557,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1571,8 +1585,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1596,8 +1613,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1621,8 +1641,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1646,8 +1669,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1671,8 +1697,11 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_web_transactions_test( + test_id=test_id, + aid=aid, + _headers=self.te_headers("delete_web_transactions_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1685,242 +1714,244 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "web-transactions", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "credentials" : [ "3247", "1051" ], - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "transactionScript" : "if (true) { return true; }", - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 30, - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username", - "targetTime" : 1 + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 } """ expected_response = json.loads(response_body_json) response = self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -1931,7 +1962,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -1943,10 +1973,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1957,7 +1990,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -1972,10 +2004,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1986,7 +2021,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2001,10 +2035,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2015,7 +2052,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2030,10 +2066,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2044,7 +2083,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2059,10 +2097,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2073,7 +2114,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): test_id = '202701' aid = '1234' version_id = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -2088,10 +2128,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_web_transactions_test( + test_id=test_id, + aid=aid, + version_id=version_id, - expand=expand, + _headers=self.te_headers("get_web_transactions_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2104,250 +2147,252 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): aid = '1234' response_body_json = """ { - "tests" : [ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "web-transactions", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "transactionScript" : "if (true) { return true; }", - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "timeLimit" : 30, - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username", - "targetTime" : 1 + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 }, { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "web-transactions", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "overrideProxyId" : "281474976710706", - "sslVersion" : "Auto", - "useNtlm" : false, - "downloadLimit" : 2048, - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "transactionScript" : "if (true) { return true; }", - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "timeLimit" : 30, - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username", - "targetTime" : 1 + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 } ], - "_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" + "_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_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -2367,7 +2412,9 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2390,7 +2437,9 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2413,7 +2462,9 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2436,7 +2487,9 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2459,7 +2512,9 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2482,7 +2537,9 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.get_web_transactions_tests( + aid=aid, + _headers=self.te_headers("get_web_transactions_tests", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -2626,242 +2683,244 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] response_body_json = """ { - "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", - "mtuMeasurements" : false, - "_links" : { - "testResults" : [ { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" }, { - "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + "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" + "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" } }, - "dnsOverride" : "8.8.8.8", - "bandwidthMeasurements" : true, - "probeMode" : "auto", - "includeHeaders" : true, - "type" : "web-transactions", - "oAuth" : { - "testUrl" : "https://api.thousandeyes.com/v7/status", - "requestMethod" : "post", - "postBody" : "client_id: ************", - "headers" : "Authorization: Basic ************", - "authType" : "none", - "username" : "user123", - "password" : "*******" + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" }, - "password" : "password", - "protocol" : "tcp", - "followRedirects" : true, - "chromePolicies" : "{\"ProxyMode\":\"direct\"}", - "contentRegex" : "(regex)+", - "pageLoadingStrategy" : "normal", - "testName" : "ThousandEyes Test", - "allowMicAndCamera" : false, - "browserLanguage" : "en-US", - "verifyCertificate" : false, - "overrideAgentProxy" : false, - "liveShare" : false, - "agentInterfaces" : { - "agentId" : "2954", - "ipAddress" : "192.1.1.0" + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" }, - "labels" : [ { - "labelId" : "961", - "name" : "Artem label", - "isBuiltin" : false + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false }, { - "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" + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" }, { - "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", - "value" : "San Francisco", - "key" : "Location" + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" } ], - "randomizedStartTime" : false, - "modifiedDate" : "2022-07-17T22:00:54Z", - "interval" : 60, - "emulatedDeviceId" : "2", - "sharedWithAccounts" : [ { - "name" : "Account name", - "aid" : "1234" + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" }, { - "name" : "Account name", - "aid" : "1234" + "name" : "Account name", + "aid" : "1234" } ], - "overrideProxyId" : "281474976710706", - "monitors" : [ { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" }, { - "monitorType" : "public", - "monitorId" : "1234", - "monitorName" : "Seattle, WA", - "ipAddress" : "4.69.184.193", - "countryId" : "GB", - "network" : "Level 3 Communications, Inc. (AS 3356)" + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" } ], - "sslVersion" : "Auto", - "useNtlm" : false, - "credentials" : [ "3247", "1051" ], - "downloadLimit" : 2048, - "alertRules" : [ { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" }, { - "severity" : "major", - "expression" : "((hops((hopDelay >= 100 ms))))", - "alertType" : "http-server", - "roundsViolatingMode" : "exact", - "sensitivityLevel" : "medium", - "roundsViolatingOutOf" : 5, - "roundsViolatingRequired" : 2, - "isDefault" : true, - "minimumSourcesPct" : 99, - "ruleName" : "The End of the Internet", - "minimumSources" : 10, - "ruleId" : "127094", - "direction" : "to-target" + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" } ], - "description" : "ThousandEyes Test", - "httpTimeLimit" : 5, - "blockDomains" : "domain.com/", - "usePublicBgp" : true, - "enabled" : true, - "vaultCredentials" : [ { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" }, { - "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", - "target" : "username" + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" } ], - "allowGeolocation" : false, - "allowUnsafeLegacyRenegotiation" : true, - "fixedPacketRate" : 50, - "httpVersion" : 2, - "collectProxyNetworkData" : false, - "pathTraceMode" : "classic", - "modifiedBy" : "user@user.com", - "authType" : "none", - "alertsEnabled" : true, - "customHeaders" : { - "root" : { - "header1" : "value1" + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" }, - "domains" : { - "domain1.com" : { - "header2" : "value2" + "domains" : { + "domain1.com" : { + "header2" : "value2" } }, - "all" : { - "header3" : "value3" + "all" : { + "header3" : "value3" } }, - "numPathTraces" : 3, - "bgpMeasurements" : true, - "transactionScript" : "if (true) { return true; }", - "distributedTracing" : false, - "savedEvent" : true, - "userAgent" : "curl", - "identifyAgentTrafficWithUserAgent" : false, - "networkMeasurements" : true, - "url" : "www.thousandeyes.com", - "agents" : [ { - "agentId" : "281474976710706", - "agentType" : "enterprise-cluster", - "prefix" : "99.128.0.0/11", - "coordinates" : { - "latitude" : 37.77493, - "longitude" : -122.41942 + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "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" + "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 + "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 + "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" + "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 + "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 } ], - "timeLimit" : 30, - "createdDate" : "2022-07-17T22:00:54Z", - "disableScreenshot" : false, - "createdBy" : "user@user.com", - "testId" : "281474976710706", - "subinterval" : 60, - "chromeOptions" : "--disable-gpu", - "desiredStatusCode" : "200", - "httpTargetTime" : 100, - "sslVersionId" : "0", - "username" : "username", - "targetTime" : 1 + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 } """ expected_response = json.loads(response_body_json) response = self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -3003,7 +3062,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3027,10 +3085,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3172,7 +3233,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -3184,10 +3244,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3329,7 +3392,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3344,10 +3406,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3489,7 +3554,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3504,10 +3568,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3649,7 +3716,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3664,10 +3730,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3809,7 +3878,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3824,10 +3892,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -3969,7 +4040,6 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) test_id = '202701' aid = '1234' - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] error_body_json = """ { "instance" : "instance", @@ -3984,10 +4054,13 @@ class TestWebTransactionTestsApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(502) ) as context: self.api.update_web_transactions_test( + test_id=test_id, + web_transaction_test_request=web_transaction_test_request, + aid=aid, - expand=expand, + _headers=self.te_headers("update_web_transactions_test", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-usage/test/test_quotas_api_integration.py b/thousandeyes-sdk-usage/test/test_quotas_api_integration.py index 6d61f6a2..49a00ba4 100644 --- a/thousandeyes-sdk-usage/test/test_quotas_api_integration.py +++ b/thousandeyes-sdk-usage/test/test_quotas_api_integration.py @@ -59,30 +59,32 @@ class TestQuotasApiIntegration(IntegrationTestBase): organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json) response_body_json = """ { - "organizations" : [ { - "orgId" : "1234", - "accountGroups" : [ { - "value" : 12000, - "aid" : "1234" + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" }, { - "value" : 12000, - "aid" : "1234" + "value" : 12000, + "aid" : "1234" } ] }, { - "orgId" : "1234", - "accountGroups" : [ { - "value" : 12000, - "aid" : "1234" + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" }, { - "value" : 12000, - "aid" : "1234" + "value" : 12000, + "aid" : "1234" } ] } ] } """ expected_response = json.loads(response_body_json) response = self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -139,7 +141,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -184,7 +188,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -232,7 +238,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -280,7 +288,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -328,7 +338,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -376,7 +388,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.assign_organizations_account_groups_quotas( + organizations_quotas_assign=organizations_quotas_assign, + _headers=self.te_headers("assign_organizations_account_groups_quotas", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -401,18 +415,20 @@ class TestQuotasApiIntegration(IntegrationTestBase): quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json) response_body_json = """ { - "organizations" : [ { - "orgId" : "1234", - "value" : 12000 + "organizations" : [ { + "orgId" : "1234", + "value" : 12000 }, { - "orgId" : "12345", - "value" : 10000 + "orgId" : "12345", + "value" : 10000 } ] } """ expected_response = json.loads(response_body_json) response = self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -456,7 +472,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -488,7 +506,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -523,7 +543,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -558,7 +580,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -593,7 +617,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -628,7 +654,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.assign_organizations_quotas( + quotas_assign_request=quotas_assign_request, + _headers=self.te_headers("assign_organizations_quotas", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -640,47 +668,48 @@ class TestQuotasApiIntegration(IntegrationTestBase): """Integration test for get_quotas success path""" response_body_json = """ { - "quotas" : [ { - "accountGroupQuotas" : [ { - "value" : 12000, - "aid" : "1234" + "quotas" : [ { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" }, { - "value" : 10000, - "aid" : "12345" + "value" : 10000, + "aid" : "12345" } ], - "organizationQuota" : { - "value" : 22500, - "orgId" : "10" + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" } }, { - "accountGroupQuotas" : [ { - "value" : 12000, - "aid" : "1234" + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" }, { - "value" : 10000, - "aid" : "12345" + "value" : 10000, + "aid" : "12345" } ], - "organizationQuota" : { - "value" : 22500, - "orgId" : "10" + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" } } ], - "_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" + "_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_quotas( + _headers=self.te_headers("get_quotas"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -711,6 +740,7 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_quotas( + _headers=self.te_headers("get_quotas", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -729,6 +759,7 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_quotas( + _headers=self.te_headers("get_quotas", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -750,6 +781,7 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_quotas( + _headers=self.te_headers("get_quotas", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -771,6 +803,7 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_quotas( + _headers=self.te_headers("get_quotas", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -792,6 +825,7 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_quotas( + _headers=self.te_headers("get_quotas", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -813,6 +847,7 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_quotas( + _headers=self.te_headers("get_quotas", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -837,7 +872,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): """ organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json) response = self.api.unassign_organizations_account_groups_quotas_with_http_info( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas"), ) self.assertEqual(204, response.status_code) @@ -883,7 +920,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -916,7 +955,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -952,7 +993,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -988,7 +1031,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1024,7 +1069,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1060,7 +1107,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.unassign_organizations_account_groups_quotas( + organizations_quotas_unassign=organizations_quotas_unassign, + _headers=self.te_headers("unassign_organizations_account_groups_quotas", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1079,7 +1128,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): """ quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json) response = self.api.unassign_organizations_quotas_with_http_info( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas"), ) self.assertEqual(204, response.status_code) @@ -1119,7 +1170,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1146,7 +1199,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1176,7 +1231,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1206,7 +1263,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1236,7 +1295,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -1266,7 +1327,9 @@ class TestQuotasApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.unassign_organizations_quotas( + quotas_unassign=quotas_unassign, + _headers=self.te_headers("unassign_organizations_quotas", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) diff --git a/thousandeyes-sdk-usage/test/test_usage_api_integration.py b/thousandeyes-sdk-usage/test/test_usage_api_integration.py index 8f548d97..dc835747 100644 --- a/thousandeyes-sdk-usage/test/test_usage_api_integration.py +++ b/thousandeyes-sdk-usage/test/test_usage_api_integration.py @@ -36,60 +36,64 @@ class TestUsageApiIntegration(IntegrationTestBase): cursor = 'cursor_example' 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" + "_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" + "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" + "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" } }, - "breakdowns" : [ { - "aid" : "1234", - "agentId" : "123456", - "accountGroupName" : "Support", - "agentName" : "TEVA-test-agent", - "enterpriseUnitsUsed" : 599878, - "enterpriseUnitsProjected" : 597808 + "breakdowns" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 }, { - "aid" : "315", - "agentId" : "789", - "accountGroupName" : "Documentation", - "agentName" : "lab-physical-appliance-1", - "enterpriseUnitsUsed" : 597123, - "enterpriseUnitsProjected" : 597808 + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -123,9 +127,13 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -147,9 +155,13 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -174,9 +186,13 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -201,9 +217,13 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -228,9 +248,13 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -255,9 +279,13 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_enterprise_agents_units_usage( + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_enterprise_agents_units_usage", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -273,67 +301,72 @@ class TestUsageApiIntegration(IntegrationTestBase): cursor = 'cursor_example' 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" + "_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" + "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" + "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" } }, - "breakdowns" : [ { - "testId" : "1158", - "testName" : "https://app.thousandeyes.com", - "testType" : "Web-Page Load", - "enterpriseUnitsUsed" : 14050, - "enterpriseUnitsProjected" : 340674, - "cloudUnitsUsed" : 10000, - "cloudUnitsProjected" : 12000, - "aid" : "1234", - "accountGroupName" : "Support" + "breakdowns" : [ { + "testId" : "1158", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "enterpriseUnitsUsed" : 14050, + "enterpriseUnitsProjected" : 340674, + "cloudUnitsUsed" : 10000, + "cloudUnitsProjected" : 12000, + "aid" : "1234", + "accountGroupName" : "Support" }, { - "testId" : "1221", - "testName" : "https://app.thousandeyes.com", - "testType" : "Web - HTTP Server", - "enterpriseUnitsUsed" : 194051, - "enterpriseUnitsProjected" : 30622, - "cloudUnitsUsed" : 12000, - "cloudUnitsProjected" : 13000, - "aid" : "1234", - "accountGroupName" : "Support" + "testId" : "1221", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web - HTTP Server", + "enterpriseUnitsUsed" : 194051, + "enterpriseUnitsProjected" : 30622, + "cloudUnitsUsed" : 12000, + "cloudUnitsProjected" : 13000, + "aid" : "1234", + "accountGroupName" : "Support" } ] } """ expected_response = json.loads(response_body_json) response = self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -368,10 +401,15 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -394,10 +432,15 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -423,10 +466,15 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -452,10 +500,15 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -481,10 +534,15 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -510,10 +568,15 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_tests_units_usage( + aid=aid, + start_date=start_date, + end_date=end_date, + cursor=cursor, + _headers=self.te_headers("get_tests_units_usage", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -524,128 +587,128 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_happy_path(self) -> None: """Integration test for get_usage success path""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] 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" + "_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" } }, - "usage" : { - "cloudUnitsProjected" : 20993812, - "connectedDevicesUnitsUsed" : 79640902, - "enterpriseAgentsUsed" : 58, - "endpointAgents" : [ { - "aid" : "1234", - "accountGroupName" : "Support", - "endpointAgentsUsed" : 22 + "usage" : { + "cloudUnitsProjected" : 20993812, + "connectedDevicesUnitsUsed" : 79640902, + "enterpriseAgentsUsed" : 58, + "endpointAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsUsed" : 22 }, { - "aid" : "12345", - "accountGroupName" : "Documentation", - "endpointAgentsUsed" : 14 + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsUsed" : 14 } ], - "cloudUnitsNextBillingPeriod" : 25123456, - "enterpriseUnitsNextBillingPeriod" : 0, - "endpointAgentsUsed" : 42, - "enterpriseUnitsUsed" : 79640902, - "cloudUnitsUsed" : 8500489, - "connectedDevicesUnitsNextBillingPeriod" : 0, - "connectedDevicesUnitsProjected" : 108016317, - "tests" : [ { - "aid" : "1234", - "testId" : "1158", - "accountGroupName" : "Documentation", - "testName" : "https://app.thousandeyes.com", - "testType" : "Web-Page Load", - "cloudUnitsUsed" : 14050, - "cloudUnitsProjected" : 340674 + "cloudUnitsNextBillingPeriod" : 25123456, + "enterpriseUnitsNextBillingPeriod" : 0, + "endpointAgentsUsed" : 42, + "enterpriseUnitsUsed" : 79640902, + "cloudUnitsUsed" : 8500489, + "connectedDevicesUnitsNextBillingPeriod" : 0, + "connectedDevicesUnitsProjected" : 108016317, + "tests" : [ { + "aid" : "1234", + "testId" : "1158", + "accountGroupName" : "Documentation", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "cloudUnitsUsed" : 14050, + "cloudUnitsProjected" : 340674 }, { - "aid" : "12345", - "testId" : "1159", - "accountGroupName" : "Documentation", - "testName" : "https://support.thousandeyes.com", - "testType" : "Web - HTTP Server", - "cloudUnitsUsed" : 64390, - "cloudUnitsProjected" : 164457 + "aid" : "12345", + "testId" : "1159", + "accountGroupName" : "Documentation", + "testName" : "https://support.thousandeyes.com", + "testType" : "Web - HTTP Server", + "cloudUnitsUsed" : 64390, + "cloudUnitsProjected" : 164457 } ], - "endpointAgentsEmbedded" : [ { - "aid" : "1234", - "accountGroupName" : "Support", - "endpointAgentsEmbeddedUsed" : 2 + "endpointAgentsEmbedded" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEmbeddedUsed" : 2 }, { - "aid" : "12345", - "accountGroupName" : "Documentation", - "endpointAgentsEmbeddedUsed" : 3 + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEmbeddedUsed" : 3 } ], - "allocations" : { - "used" : 1000, - "projected" : 1000, - "allocations" : [ { - "productName" : "Some Product Name", - "allocatedUnits" : 600 + "allocations" : { + "used" : 1000, + "projected" : 1000, + "allocations" : [ { + "productName" : "Some Product Name", + "allocatedUnits" : 600 } ] }, - "endpointAgentsEssentialsUsed" : 5, - "quota" : { - "monthEnd" : "2020-02-05T08:00:00Z", - "endpointAgentsEmbeddedIncluded" : 10, - "enterpriseAgentsIncluded" : 25, - "monthStart" : "2020-01-05T08:00:00Z", - "cloudUnitsIncluded" : 4320000000, - "deviceAgentsIncluded" : 100, - "endpointAgentsIncluded" : 200, - "endpointAgentsEssentialsIncluded" : 10 + "endpointAgentsEssentialsUsed" : 5, + "quota" : { + "monthEnd" : "2020-02-05T08:00:00Z", + "endpointAgentsEmbeddedIncluded" : 10, + "enterpriseAgentsIncluded" : 25, + "monthStart" : "2020-01-05T08:00:00Z", + "cloudUnitsIncluded" : 4320000000, + "deviceAgentsIncluded" : 100, + "endpointAgentsIncluded" : 200, + "endpointAgentsEssentialsIncluded" : 10 }, - "enterpriseUnitsProjected" : 108016317, - "endpointAgentsEmbeddedUsed" : 5, - "enterpriseAgents" : [ { - "aid" : "1234", - "accountGroupName" : "Support", - "enterpriseAgentsUsed" : 7 + "enterpriseUnitsProjected" : 108016317, + "endpointAgentsEmbeddedUsed" : 5, + "enterpriseAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "enterpriseAgentsUsed" : 7 }, { - "aid" : "12345", - "accountGroupName" : "Documentation", - "enterpriseAgentsUsed" : 1 + "aid" : "12345", + "accountGroupName" : "Documentation", + "enterpriseAgentsUsed" : 1 } ], - "enterpriseAgentUnits" : [ { - "aid" : "1234", - "agentId" : "123456", - "accountGroupName" : "Support", - "agentName" : "TEVA-test-agent", - "enterpriseUnitsUsed" : 599878, - "enterpriseUnitsProjected" : 597808 + "enterpriseAgentUnits" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 }, { - "aid" : "315", - "agentId" : "789", - "accountGroupName" : "Documentation", - "agentName" : "lab-physical-appliance-1", - "enterpriseUnitsUsed" : 597123, - "enterpriseUnitsProjected" : 597808 + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 } ], - "endpointAgentsEssentials" : [ { - "aid" : "1234", - "accountGroupName" : "Support", - "endpointAgentsEssentialsUsed" : 2 + "endpointAgentsEssentials" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEssentialsUsed" : 2 }, { - "aid" : "12345", - "accountGroupName" : "Documentation", - "endpointAgentsEssentialsUsed" : 3 + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEssentialsUsed" : 3 } ] } } """ expected_response = json.loads(response_body_json) response = self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage"), ) assert_constructed_model_matches_example_json(response, expected_response) @@ -654,7 +717,6 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_error_400(self) -> None: """Integration test for get_usage error path (HTTP 400)""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] error_body_json = """ { "instance" : "instance", @@ -678,8 +740,9 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(400) ) as context: self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -688,7 +751,6 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_error_401(self) -> None: """Integration test for get_usage error path (HTTP 401)""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] error_body_json = """ { "error_description" : "Invalid access token", @@ -700,8 +762,9 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(401) ) as context: self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -710,7 +773,6 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_error_403(self) -> None: """Integration test for get_usage error path (HTTP 403)""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] error_body_json = """ { "instance" : "instance", @@ -725,8 +787,9 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(403) ) as context: self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -735,7 +798,6 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_error_404(self) -> None: """Integration test for get_usage error path (HTTP 404)""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] error_body_json = """ { "instance" : "instance", @@ -750,8 +812,9 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(404) ) as context: self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -760,7 +823,6 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_error_429(self) -> None: """Integration test for get_usage error path (HTTP 429)""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] error_body_json = """ { "instance" : "instance", @@ -775,8 +837,9 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(429) ) as context: self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) @@ -785,7 +848,6 @@ class TestUsageApiIntegration(IntegrationTestBase): def test_get_usage_error_500(self) -> None: """Integration test for get_usage error path (HTTP 500)""" aid = '1234' - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] error_body_json = """ { "instance" : "instance", @@ -800,8 +862,9 @@ class TestUsageApiIntegration(IntegrationTestBase): ApiException.exception_class_for_http_status(500) ) as context: self.api.get_usage( + aid=aid, - expand=expand, + _headers=self.te_headers("get_usage", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) From f1f280d48c64f24a2e2ca111ec75148c8e60fc0f Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 28 Jul 2026 12:22:48 +0100 Subject: [PATCH 4/7] Normalize ISO8601 datetimes in mock server request body matching. Treat Z and +00:00 as equivalent when comparing serialized SDK request bodies to OAS examples, fixing alert suppression window integration tests. Co-authored-by: Cursor --- .../test/sdk_test_support/mock_server.py | 12 +++++++- .../test/test_mock_server.py | 29 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py b/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py index 37354bca..8479728d 100644 --- a/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py +++ b/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py @@ -19,6 +19,7 @@ from __future__ import annotations import json import re import threading +from datetime import datetime from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from typing import Any, Dict, Mapping, Optional from urllib.parse import urlparse @@ -30,12 +31,21 @@ ERROR_STATUS_HEADER = "X-TE-Error-Status" AUTHORIZATION_HEADER = "Authorization" +def _normalize_scalar(value: Any) -> Any: + if isinstance(value, str) and "T" in value: + try: + return datetime.fromisoformat(value.replace("Z", "+00:00")).isoformat().replace("+00:00", "Z") + except ValueError: + return value + return value + + def _normalize_json(value: Any) -> Any: if isinstance(value, dict): return {key: _normalize_json(value[key]) for key in sorted(value.keys())} if isinstance(value, list): return [_normalize_json(item) for item in value] - return value + return _normalize_scalar(value) def _json_body_matches(expected: Any, actual: Any) -> bool: diff --git a/thousandeyes-sdk-core/test/test_mock_server.py b/thousandeyes-sdk-core/test/test_mock_server.py index d847a309..940c05ba 100644 --- a/thousandeyes-sdk-core/test/test_mock_server.py +++ b/thousandeyes-sdk-core/test/test_mock_server.py @@ -185,3 +185,32 @@ def test_mock_server_rejects_path_missing_path_variable(manifest): ) assert status == 400 assert json.loads(body.decode("utf-8"))["detail"] == "Path does not match operation expectation" + + +def test_mock_server_accepts_equivalent_iso8601_datetime_formats(manifest): + datetime_manifest = { + **manifest, + "createAlertRule": OperationExpectation( + operation_id="createAlertRule", + method="POST", + path="/alerts/rules", + request_body_example={ + "ruleName": "Example", + "startDate": "2017-07-01T05:00:00Z", + }, + success_status=201, + success_body={"ruleId": "1"}, + ), + } + with MockApiServer(datetime_manifest) as server: + status, body = _request( + server, + method="POST", + path="/alerts/rules", + body={ + "ruleName": "Example", + "startDate": "2017-07-01T05:00:00+00:00", + }, + ) + assert status == 201 + assert json.loads(body.decode("utf-8")) == {"ruleId": "1"} From 39517ce6d183b8dfdf35903b73169359118f1a1f Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 28 Jul 2026 12:40:21 +0100 Subject: [PATCH 5/7] Fix mock server nested body matching and array response tests. Recursively ignore read-only fields in nested request objects and regenerate dashboards/streaming integration tests for list responses. Co-authored-by: Cursor --- .../test/sdk_test_support/mock_server.py | 13 +++++-- .../test/test_mock_server.py | 35 +++++++++++++++++++ .../test/test_dashboards_api_integration.py | 5 ++- .../test/test_streaming_api_integration.py | 5 ++- 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py b/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py index 8479728d..33e9d38b 100644 --- a/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py +++ b/thousandeyes-sdk-core/test/sdk_test_support/mock_server.py @@ -50,8 +50,17 @@ def _normalize_json(value: Any) -> Any: def _json_body_matches(expected: Any, actual: Any) -> bool: if isinstance(expected, dict) and isinstance(actual, dict): - filtered_expected = {key: expected[key] for key in actual if key in expected} - return _normalize_json(filtered_expected) == _normalize_json(actual) + for key in actual: + if key not in expected: + return False + if not _json_body_matches(expected[key], actual[key]): + return False + return True + if isinstance(expected, list) and isinstance(actual, list): + if len(expected) != len(actual): + return False + return all(_json_body_matches(expected_item, actual_item) + for expected_item, actual_item in zip(expected, actual)) return _normalize_json(expected) == _normalize_json(actual) diff --git a/thousandeyes-sdk-core/test/test_mock_server.py b/thousandeyes-sdk-core/test/test_mock_server.py index 940c05ba..a34a7580 100644 --- a/thousandeyes-sdk-core/test/test_mock_server.py +++ b/thousandeyes-sdk-core/test/test_mock_server.py @@ -214,3 +214,38 @@ def test_mock_server_accepts_equivalent_iso8601_datetime_formats(manifest): ) assert status == 201 assert json.loads(body.decode("utf-8")) == {"ruleId": "1"} + + +def test_mock_server_ignores_readonly_fields_in_nested_request_objects(manifest): + nested_manifest = { + **manifest, + "createAlertRule": OperationExpectation( + operation_id="createAlertRule", + method="POST", + path="/alerts/rules", + request_body_example={ + "ruleName": "Example", + "widgets": [ + { + "title": "Widget Title", + "id": "read-only-id", + "embedUrl": "https://example.com/embed", + } + ], + }, + success_status=201, + success_body={"ruleId": "1"}, + ), + } + with MockApiServer(nested_manifest) as server: + status, body = _request( + server, + method="POST", + path="/alerts/rules", + body={ + "ruleName": "Example", + "widgets": [{"title": "Widget Title"}], + }, + ) + assert status == 201 + assert json.loads(body.decode("utf-8")) == {"ruleId": "1"} diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py index 52cd5593..c2ff1ea4 100644 --- a/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py @@ -2916,7 +2916,10 @@ class TestDashboardsApiIntegration(IntegrationTestBase): _headers=self.te_headers("get_dashboards"), ) - assert_constructed_model_matches_example_json(response, expected_response) + self.assertIsInstance(response, list) + self.assertEqual(len(response), len(expected_response)) + for index, element in enumerate(response): + assert_constructed_model_matches_example_json(element, expected_response[index]) def test_get_dashboards_error_400(self) -> None: diff --git a/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py index d196589f..01fff3ef 100644 --- a/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py +++ b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py @@ -907,7 +907,10 @@ class TestStreamingApiIntegration(IntegrationTestBase): _headers=self.te_headers("get_streams"), ) - assert_constructed_model_matches_example_json(response, expected_response) + self.assertIsInstance(response, list) + self.assertEqual(len(response), len(expected_response)) + for index, element in enumerate(response): + assert_constructed_model_matches_example_json(element, expected_response[index]) def test_get_streams_error_400(self) -> None: From 85d34d7c26dac069fba70062503b87e8dbd62e80 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 28 Jul 2026 12:59:23 +0100 Subject: [PATCH 6/7] Fix integration test boolean literals and response assertion mismatches. Regenerate endpoint-agents and event-detection integration tests with Python booleans, sync get_events ongoing param support, and compare responses using only fields present in constructed models. Co-authored-by: Cursor --- .../test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-agents/test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-alerts/test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-emulation/test/test_utils.py | 23 ++++++++++++++- .../test_endpoint_agents_api_integration.py | 28 +++++++++---------- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../event_detection/api/events_api.py | 24 ++++++++++++++-- .../test/test_events_api_integration.py | 16 +++++------ .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-snapshots/test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-streaming/test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-tags/test/test_utils.py | 23 ++++++++++++++- .../test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-tests/test/test_utils.py | 23 ++++++++++++++- thousandeyes-sdk-usage/test/test_utils.py | 23 ++++++++++++++- 25 files changed, 528 insertions(+), 46 deletions(-) diff --git a/thousandeyes-sdk-administrative/test/test_utils.py b/thousandeyes-sdk-administrative/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-administrative/test/test_utils.py +++ b/thousandeyes-sdk-administrative/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-agents/test/test_utils.py b/thousandeyes-sdk-agents/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-agents/test/test_utils.py +++ b/thousandeyes-sdk-agents/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-alerts/test/test_utils.py b/thousandeyes-sdk-alerts/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-alerts/test/test_utils.py +++ b/thousandeyes-sdk-alerts/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-bgp-monitors/test/test_utils.py b/thousandeyes-sdk-bgp-monitors/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-bgp-monitors/test/test_utils.py +++ b/thousandeyes-sdk-bgp-monitors/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-connectors/test/test_utils.py b/thousandeyes-sdk-connectors/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-connectors/test/test_utils.py +++ b/thousandeyes-sdk-connectors/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-credentials/test/test_utils.py b/thousandeyes-sdk-credentials/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-credentials/test/test_utils.py +++ b/thousandeyes-sdk-credentials/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-dashboards/test/test_utils.py b/thousandeyes-sdk-dashboards/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-dashboards/test/test_utils.py +++ b/thousandeyes-sdk-dashboards/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-emulation/test/test_utils.py b/thousandeyes-sdk-emulation/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-emulation/test/test_utils.py +++ b/thousandeyes-sdk-emulation/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py index 6ab87427..9fa0ce7c 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py @@ -820,7 +820,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False response_body_json = """ { "_links" : { @@ -1261,7 +1261,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "instance" : "instance", @@ -1347,7 +1347,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "error_description" : "Invalid access token", @@ -1421,7 +1421,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "instance" : "instance", @@ -1498,7 +1498,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "instance" : "instance", @@ -1535,7 +1535,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent success path""" agent_id = 'agent_id_example' aid = '1234' - include_deleted = false + include_deleted = False response_body_json = """ { "npcapVersion" : "npcapVersion", @@ -1736,7 +1736,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 401)""" agent_id = 'agent_id_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "error_description" : "Invalid access token", @@ -1764,7 +1764,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 403)""" agent_id = 'agent_id_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "instance" : "instance", @@ -1795,7 +1795,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 404)""" agent_id = 'agent_id_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "instance" : "instance", @@ -1826,7 +1826,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): """Integration test for get_endpoint_agent error path (HTTP 429)""" agent_id = 'agent_id_example' aid = '1234' - include_deleted = false + include_deleted = False error_body_json = """ { "instance" : "instance", @@ -1860,7 +1860,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False use_all_permitted_aids = False agent_name = 'agent_name_example' computer_name = 'computer_name_example' @@ -2277,7 +2277,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False use_all_permitted_aids = False agent_name = 'agent_name_example' computer_name = 'computer_name_example' @@ -2317,7 +2317,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False use_all_permitted_aids = False agent_name = 'agent_name_example' computer_name = 'computer_name_example' @@ -2360,7 +2360,7 @@ class TestEndpointAgentsApiIntegration(IntegrationTestBase): max = 5 cursor = 'cursor_example' aid = '1234' - include_deleted = false + include_deleted = False use_all_permitted_aids = False agent_name = 'agent_name_example' computer_name = 'computer_name_example' diff --git a/thousandeyes-sdk-endpoint-agents/test/test_utils.py b/thousandeyes-sdk-endpoint-agents/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-labels/test/test_utils.py b/thousandeyes-sdk-endpoint-labels/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-labels/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-labels/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_utils.py b/thousandeyes-sdk-endpoint-test-results/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-tests/test/test_utils.py b/thousandeyes-sdk-endpoint-tests/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/api/events_api.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/api/events_api.py index afd97f04..3b98006a 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/api/events_api.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/api/events_api.py @@ -19,7 +19,7 @@ from importlib.metadata import version import thousandeyes_sdk.event_detection.models from datetime import datetime -from pydantic import Field, StrictInt, StrictStr, field_validator +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated from thousandeyes_sdk.event_detection.models.event_detail import EventDetail @@ -350,6 +350,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -379,6 +380,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -403,7 +406,7 @@ class EventsApi: return PaginationIterable( self.get_events, lambda data: data.events if data and data.events else [], - aid = aid, window = window, start_date = start_date, end_date = end_date, max = max, cursor = cursor, + aid = aid, window = window, start_date = start_date, end_date = end_date, max = max, cursor = cursor, ongoing = ongoing, _request_timeout=_request_timeout, _request_auth=_request_auth, _content_type=_content_type, @@ -421,6 +424,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -450,6 +454,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -479,6 +485,7 @@ class EventsApi: end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -516,6 +523,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -545,6 +553,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -574,6 +584,7 @@ class EventsApi: end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -611,6 +622,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -640,6 +652,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -669,6 +683,7 @@ class EventsApi: end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -700,6 +715,7 @@ class EventsApi: end_date, max, cursor, + ongoing, _request_auth, _content_type, _headers, @@ -762,6 +778,10 @@ class EventsApi: _query_params.append(('cursor', cursor)) + if ongoing is not None: + + _query_params.append(('ongoing', ongoing)) + # process the header parameters # process the form parameters # process the body parameter diff --git a/thousandeyes-sdk-event-detection/test/test_events_api_integration.py b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py index f301b81b..4b0ca5d1 100644 --- a/thousandeyes-sdk-event-detection/test/test_events_api_integration.py +++ b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py @@ -353,7 +353,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True response_body_json = """ { "endDate" : "2022-07-18T22:00:54Z", @@ -482,7 +482,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "instance" : "instance", @@ -534,7 +534,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "error_description" : "Invalid access token", @@ -574,7 +574,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "instance" : "instance", @@ -617,7 +617,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "instance" : "instance", @@ -660,7 +660,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "instance" : "instance", @@ -703,7 +703,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "instance" : "instance", @@ -746,7 +746,7 @@ class TestEventsApiIntegration(IntegrationTestBase): end_date = '2022-07-18T22:00:54Z' max = 5 cursor = 'cursor_example' - ongoing = true + ongoing = True error_body_json = """ { "instance" : "instance", diff --git a/thousandeyes-sdk-event-detection/test/test_utils.py b/thousandeyes-sdk-event-detection/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-event-detection/test/test_utils.py +++ b/thousandeyes-sdk-event-detection/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-instant-tests/test/test_utils.py b/thousandeyes-sdk-instant-tests/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-instant-tests/test/test_utils.py +++ b/thousandeyes-sdk-instant-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-internet-insights/test/test_utils.py b/thousandeyes-sdk-internet-insights/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-internet-insights/test/test_utils.py +++ b/thousandeyes-sdk-internet-insights/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-snapshots/test/test_utils.py b/thousandeyes-sdk-snapshots/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-snapshots/test/test_utils.py +++ b/thousandeyes-sdk-snapshots/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-streaming/test/test_utils.py b/thousandeyes-sdk-streaming/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-streaming/test/test_utils.py +++ b/thousandeyes-sdk-streaming/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-tags/test/test_utils.py b/thousandeyes-sdk-tags/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-tags/test/test_utils.py +++ b/thousandeyes-sdk-tags/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-test-results/test/test_utils.py b/thousandeyes-sdk-test-results/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-test-results/test/test_utils.py +++ b/thousandeyes-sdk-test-results/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-tests/test/test_utils.py b/thousandeyes-sdk-tests/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-tests/test/test_utils.py +++ b/thousandeyes-sdk-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-usage/test/test_utils.py b/thousandeyes-sdk-usage/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-usage/test/test_utils.py +++ b/thousandeyes-sdk-usage/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) From a8102f1fc7216a5a8a383959c105972151df92bc Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 28 Jul 2026 17:03:58 +0100 Subject: [PATCH 7/7] add test for validating OAS not match case --- .../test/test_mock_server.py | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/thousandeyes-sdk-core/test/test_mock_server.py b/thousandeyes-sdk-core/test/test_mock_server.py index a34a7580..26d5676c 100644 --- a/thousandeyes-sdk-core/test/test_mock_server.py +++ b/thousandeyes-sdk-core/test/test_mock_server.py @@ -249,3 +249,67 @@ def test_mock_server_ignores_readonly_fields_in_nested_request_objects(manifest) ) assert status == 201 assert json.loads(body.decode("utf-8")) == {"ruleId": "1"} + + +def test_integration_error_assertion_fails_when_deserialized_error_does_not_match_oas_example(): + """Generated error-path tests compare ApiException.data to the OAS error example.""" + import unittest + import urllib.error + import urllib.request + + from pydantic import BaseModel, ConfigDict + + class Error(BaseModel): + title: str + status: int + + model_config = ConfigDict(extra="allow") + + def to_json(self) -> str: + return self.model_dump_json() + + mismatched_manifest = { + "createAlertRule": OperationExpectation( + operation_id="createAlertRule", + method="POST", + path="/alerts/rules", + request_body_example={"ruleName": "Example"}, + success_status=201, + success_body={"ruleId": "1"}, + error_responses={ + "400": ErrorResponseExpectation( + status=400, + body={"title": "Wrong Title", "status": 400}, + ) + }, + ), + } + oas_example = {"title": "Bad Request", "status": 400} + + with MockApiServer(mismatched_manifest) as server: + request = urllib.request.Request( + server.base_url + "/alerts/rules", + data=json.dumps({"unexpected": True}).encode("utf-8"), + headers={ + AUTHORIZATION_HEADER: "Bearer test-token", + OPERATION_ID_HEADER: "createAlertRule", + ERROR_STATUS_HEADER: "400", + "Content-Type": "application/json", + }, + method="POST", + ) + with pytest.raises(urllib.error.HTTPError) as http_error: + urllib.request.urlopen(request) + wire_body = json.loads(http_error.value.read().decode("utf-8")) + + exception_data = Error.model_validate(wire_body) + + def assert_constructed_model_matches_example_json(model, loaded_json): + test_case = unittest.TestCase() + test_case.assertEqual( + json.dumps(loaded_json, sort_keys=True), + json.dumps(json.loads(model.to_json()), sort_keys=True), + ) + + with pytest.raises(AssertionError): + assert_constructed_model_matches_example_json(exception_data, oas_example)